Change in vdsm[ovirt-3.5-gluster]: gluster: revamp in geo-replication status and list verbs.

dnarayan at redhat.com dnarayan at redhat.com
Fri May 15 06:31:46 UTC 2015


Hello Piotr Kliczewski, Timothy Asir, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/40950

to review the following change.

Change subject: gluster: revamp in geo-replication status and list verbs.
......................................................................

gluster: revamp in geo-replication status and list verbs.

This patch modifies geo-replication status and geo-replication
list verbs to accomodate the corresponding changes in gluster
geo-replication.

Change-Id: Ia9405e936b69e9dd4d2ed6621cfc1c70752def26
Signed-off-by: Darshan N <dnarayan at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/39910
Reviewed-by: Timothy Asir <tjeyasin at redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/glusterGeoRepStatus.xml
M tests/glusterTestData.py
M tests/gluster_cli_tests.py
M vdsm/gluster/api.py
M vdsm/gluster/cli.py
M vdsm/rpc/vdsmapi-gluster-schema.json
6 files changed, 88 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/40950/1

diff --git a/tests/glusterGeoRepStatus.xml b/tests/glusterGeoRepStatus.xml
index cf3a28c..d1dc2ca 100644
--- a/tests/glusterGeoRepStatus.xml
+++ b/tests/glusterGeoRepStatus.xml
@@ -15,14 +15,17 @@
             <master_brick>/root/b1_vol1</master_brick>
 	    <slave_user>root</slave_user>
             <slave>192.168.122.145::vol2</slave>
+	    <slave_node>192.168.122.145</slave_node>
             <status>Stopped</status>
-            <checkpoint_status>N/A</checkpoint_status>
             <crawl_status>N/A</crawl_status>
-            <files_syncd>0</files_syncd>
-            <files_pending>0</files_pending>
-            <bytes_pending>0</bytes_pending>
-            <deletes_pending>0</deletes_pending>
-            <files_skipped>0</files_skipped>
+            <last_synced>2014-12-12 05:18:23</last_synced>
+            <entry>0</entry>
+            <data>0</data>
+            <meta>0</meta>
+            <failures>0</failures>
+	    <checkpoint_time>2014-12-12 05:17:23</checkpoint_time>
+	    <checkpoint_completion_time>2014-12-12 05:18:20</checkpoint_completion_time>
+	    <checkpoint_completed>Yes</checkpoint_completed>
           </pair>
         </session>
       </sessions>
diff --git a/tests/glusterTestData.py b/tests/glusterTestData.py
index 0fdb7ef..ef49287 100644
--- a/tests/glusterTestData.py
+++ b/tests/glusterTestData.py
@@ -1059,21 +1059,24 @@
         'sessions': [
             {'bricks': [
                 {'status': 'Stopped',
-                 'bytesPending': '0',
                  'brickName': '/root/b1_vol1',
                  'crawlStatus': 'N/A',
-                 'filesPending': '0',
-                 'filesSynced': '0',
-                 'remoteUserName': 'root',
                  'hostUuid': '6a2f7584-05a8-4651-8786-1cd6ae87b896',
                  'remoteHost': '192.168.122.145',
-                 'checkpointStatus': 'N/A',
+                 'checkpointCompletionTime': 1418361500,
+                 'meta': '0',
+                 'checkpointCompleted': 'Yes',
                  'host': 'localhost.localdomain',
-                 'filesSkipped': '0',
-                 'deletesPending': '0'}],
+                 'checkpointTime': 1418361443,
+                 'lastSynced': 1418361503,
+                 'failures': '0',
+                 'entry': '0',
+                 'remoteUserName': 'root',
+                 'timeZone': 'IST',
+                 'data': '0'}],
              'remoteVolumeName': 'vol2',
-             'sessionKey': '6a2f7584-05a8-4651-8786-1cd6ae87b896'
-             ':ssh://192.168.122.145::vol2'}
+             'sessionKey': '6a2f7584-05a8-4651-8786-1cd6ae87b896:ssh:'
+             '//192.168.122.145::vol2'}
         ]
     }
 }
diff --git a/tests/gluster_cli_tests.py b/tests/gluster_cli_tests.py
index 1084f9a..a427a8d 100644
--- a/tests/gluster_cli_tests.py
+++ b/tests/gluster_cli_tests.py
@@ -1163,7 +1163,8 @@
         with open("glusterGeoRepStatus.xml") as f:
             out = f.read()
         tree = etree.fromstring(out)
-        status = gcli._parseGeoRepStatus(tree, detail=True)
+        gcli._TIME_ZONE = 'IST'
+        status = gcli._parseGeoRepStatus(tree)
         self.assertEquals(status, glusterTestData.GLUSTER_GEOREP_STATUS)
 
     def test_parseVolumeGeoRepConfig(self):
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 40ca153..8974e8e 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -449,8 +449,7 @@
             volumeName,
             remoteHost,
             remoteVolumeName,
-            remoteUserName,
-            detail=True
+            remoteUserName
         )
         return {'sessionStatus': status}
 
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index 8af5be0..8554664 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -1122,7 +1122,7 @@
                                                                err=e.err)
 
 
-def _parseGeoRepStatus(tree, detail=False):
+def _parseGeoRepStatus(tree):
     """
     Returns:
     {volume-name: [{sessionKey: 'key to identify the session',
@@ -1133,13 +1133,17 @@
                               remoteHost: 'slave',
                               status: 'status'
                               remoteUserName: 'root'
-                              checkpointStatus: 'checkpoint status'
+                              timeZone: 'nodes time zone'
                               crawlStatus: 'crawlStatus'
-                              *filesSynced: 'nos of files syncd'
-                              *filesPending: 'nos of files Pending'
-                              *bytesPending: 'nos of bytes pending'
-                              *deletesPending: 'Nos of deletes pending'
-                              *filesSkipped: 'Nos of files skipped'}]...
+                              lastSynced: 'last synced time'
+                              entry: 'nos of entry operations pending'
+                              data: 'nos of data operations pending'
+                              meta: 'nos of meta operations pending'
+                              failures: 'nos of failures'
+                              checkpointTime: 'checkpoint set time'
+                              checkpointCompletionTime: 'checkpoint completion
+                                                         time'
+                              checkpointCompleted: 'yes/no'}]...
                ]....
     }
     """
@@ -1159,23 +1163,37 @@
                 pairDetail['hostUuid'] = pair.find(
                     'master_node_uuid').text
                 pairDetail['brickName'] = pair.find('master_brick').text
-                pairDetail['remoteHost'] = pair.find(
-                    'slave').text.split("::")[0]
+                pairDetail['remoteHost'] = pair.find('slave_node').text
                 pairDetail['remoteUserName'] = pair.find('slave_user').text
                 pairDetail['status'] = pair.find('status').text
-                pairDetail['checkpointStatus'] = pair.find(
-                    'checkpoint_status').text
                 pairDetail['crawlStatus'] = pair.find('crawl_status').text
-                if detail:
-                    pairDetail['filesSynced'] = pair.find('files_syncd').text
-                    pairDetail['filesPending'] = pair.find(
-                        'files_pending').text
-                    pairDetail['bytesPending'] = pair.find(
-                        'bytes_pending').text
-                    pairDetail['deletesPending'] = pair.find(
-                        'deletes_pending').text
-                    pairDetail['filesSkipped'] = pair.find(
-                        'files_skipped').text
+                pairDetail['timeZone'] = _TIME_ZONE
+                pairDetail['lastSynced'] = pair.find('last_synced').text
+                if pairDetail['lastSynced'] != 'N/A':
+                    pairDetail['lastSynced'] = calendar.timegm(
+                        time.strptime(pairDetail['lastSynced'],
+                                      "%Y-%m-%d %H:%M:%S"))
+
+                pairDetail['checkpointTime'] = pair.find(
+                    'checkpoint_time').text
+                if pairDetail['checkpointTime'] != 'N/A':
+                    pairDetail['checkpointTime'] = calendar.timegm(
+                        time.strptime(pairDetail['checkpointTime'],
+                                      "%Y-%m-%d %H:%M:%S"))
+
+                pairDetail['checkpointCompletionTime'] = pair.find(
+                    'checkpoint_completion_time').text
+                if pairDetail['checkpointCompletionTime'] != 'N/A':
+                    pairDetail['checkpointCompletionTime'] = calendar.timegm(
+                        time.strptime(pairDetail['checkpointCompletionTime'],
+                                      "%Y-%m-%d %H:%M:%S"))
+
+                pairDetail['entry'] = pair.find('entry').text
+                pairDetail['data'] = pair.find('data').text
+                pairDetail['meta'] = pair.find('meta').text
+                pairDetail['failures'] = pair.find('failures').text
+                pairDetail['checkpointCompleted'] = pair.find(
+                    'checkpoint_completed').text
                 pairs.append(pairDetail)
             sessionDetail['bricks'] = pairs
             sessions.append(sessionDetail)
@@ -1186,8 +1204,7 @@
 
 @makePublic
 def volumeGeoRepStatus(volumeName=None, remoteHost=None,
-                       remoteVolumeName=None, remoteUserName=None,
-                       detail=False):
+                       remoteVolumeName=None, remoteUserName=None):
     if remoteUserName:
         userAtHost = "%s@%s" % (remoteUserName, remoteHost)
     else:
@@ -1198,15 +1215,13 @@
     if remoteHost and remoteVolumeName:
         command.append("%s::%s" % (userAtHost, remoteVolumeName))
     command.append("status")
-    if detail:
-        command.append("detail")
 
     try:
         xmltree = _execGlusterXml(command)
     except ge.GlusterCmdFailedException as e:
         raise ge.GlusterGeoRepStatusFailedException(rc=e.rc, err=e.err)
     try:
-        return _parseGeoRepStatus(xmltree, detail)
+        return _parseGeoRepStatus(xmltree)
     except _etreeExceptions:
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
 
diff --git a/vdsm/rpc/vdsmapi-gluster-schema.json b/vdsm/rpc/vdsmapi-gluster-schema.json
index 0aef3e6..8b4043f 100644
--- a/vdsm/rpc/vdsmapi-gluster-schema.json
+++ b/vdsm/rpc/vdsmapi-gluster-schema.json
@@ -1387,41 +1387,47 @@
 #
 # Gluster geo-replication pair information.
 #
-# @host:               Host of the local volume
+# @host:                    Host of the local volume
 #
-# @hostUuid:           Uuid of host for local volume brick
+# @hostUuid:                Uuid of host for local volume brick
 #
-# @brickName:          Local volume brick involved in session
+# @brickName:               Local volume brick involved in session
 #
-# @remoteHost:         The remote host involved in the session
+# @remoteHost:              The remote host involved in the session
 #
-# @remoteUserName:     Name of user in remote Machine
+# @remoteUserName:          Name of user in remote Machine
 #
-# @status:             Status of geo replication
+# @status:                  Status of geo replication
 #
-# @checkpointStatus:   Status of checkpoint
+# @crawlStatus:             Crawl status
 #
-# @crawlStatus:        Crawl status
+# @timeZone:                Time zone of local node
 #
-# @filesSynced:        #optional Number of files that are synced
+# @lastSynced:              Time of last sync
 #
-# @filesPending:       #optional Number of files that are pending to be synced
+# @entry:                   Nos of entry operations pending
 #
-# @bytesPending:       #optional Number of bytes that are pending to be synced
+# @data:                    Nos of data operations pending
 #
-# @deletesPending:     #optional Number of deletes that are pending
+# @meta:                    Nos of meta operations pending
 #
-# @filesSkipped:       #optional Number of files skipped
+# @failures:                Nos of failures
+#
+# @checkpointTime           Checkpoint Set time
+#
+# @checkpointCompletionTime Checkpoint completion time
+#
+# @checkpointCompleted      If checkpoint is completed or not
 #
 # Since: 4.17.0
 ##
 {'type': 'geoRepPairInfo',
  'data': {'host': 'str', 'hostUuid': 'UUID', 'brickName': 'str',
           'remoteUserName': 'str', 'remoteHost': 'str',
-          'status': 'str', 'checkpointStatus': 'str',
-          'crawlStatus': 'str', '*filesSynced': 'str', '*filesPending': 'str',
-          '*bytesPending': 'str', '*deletesPending': 'str',
-          '*filesSkipped': 'str'}}
+          'status': 'str', 'timeZone': 'str', 'lastSynced': 'int',
+          'crawlStatus': 'str', 'entry': 'str', 'data': 'str',
+          'meta': 'str', 'failures': 'str', 'checkpointTime': 'int'
+          'checkpointCompleted': 'str', 'checkpointCompletionTime': 'int'}}
 
 ##
 # @geoRepSessionInfo:


-- 
To view, visit https://gerrit.ovirt.org/40950
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9405e936b69e9dd4d2ed6621cfc1c70752def26
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Darshan N <dnarayan at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin at redhat.com>


More information about the vdsm-patches mailing list