Change in vdsm[ovirt-3.4]: gluster: additional parsing of host UUID in verb glusterVolu...

dnarayan at redhat.com dnarayan at redhat.com
Mon Jan 20 12:45:12 UTC 2014


Hello Aravinda VK, Dan Kenigsberg, Sahina Bose,

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

    http://gerrit.ovirt.org/23438

to review the following change.

Change subject: gluster: additional parsing of host UUID in verb glusterVolumesList
......................................................................

gluster: additional parsing of host UUID in verb glusterVolumesList

This patch adds parsing of host UUID for all the bricks in the
verb glusterVolumesList.
This information is stored in bricksInfo which is list of dictionary
where each dictionary has name and hostUUID.
sample:
---------------------------------------------------------------
     'bricksInfo': [{
                     'name': '192.168.122.2:/tmp/t_b1',
                     'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d'
                     },
                    {
                     'name': '192.168.122.2:/tmp/t_b2',
                     'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d'
                     }]
---------------------------------------------------------------

Change-Id: I9ed62e687feaae997d219ee1f5fcc6373f8c49c2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1038988
Signed-off-by: ndarshan <dnarayan at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22693
Reviewed-by: Aravinda VK <avishwan at redhat.com>
Reviewed-by: Sahina Bose <sabose at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/gluster_cli_tests.py
M vdsm/gluster/cli.py
M vdsm/gluster/vdsmapi-gluster-schema.json
3 files changed, 52 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/23438/1

diff --git a/tests/gluster_cli_tests.py b/tests/gluster_cli_tests.py
index 72d98ed..335c35d 100644
--- a/tests/gluster_cli_tests.py
+++ b/tests/gluster_cli_tests.py
@@ -60,8 +60,12 @@
         <typeStr>Replicate</typeStr>
         <transport>0</transport>
         <bricks>
-          <brick>192.168.122.2:/tmp/music-b1</brick>
-          <brick>192.168.122.2:/tmp/music-b2</brick>
+          <brick>192.168.122.2:/tmp/m_b1<name>192.168.122.2:/tmp/m_b1</name>
+            <hostUuid>04eb591b-2fd3-489e-a22c-5d342a3c713d</hostUuid>
+          </brick>
+          <brick>192.168.122.2:/tmp/m_b2<name>192.168.122.2:/tmp/m_b2</name>
+            <hostUuid>04eb591b-2fd3-489e-a22c-5d342a3c713d</hostUuid>
+          </brick>
         </bricks>
         <optCount>1</optCount>
         <options>
@@ -84,7 +88,9 @@
         <typeStr>Distribute</typeStr>
         <transport>1</transport>
         <bricks>
-          <brick>192.168.122.2:/tmp/test1-b1</brick>
+          <brick>192.168.122.2:/tmp/t_b1<name>192.168.122.2:/tmp/t_b1</name>
+            <hostUuid>04eb591b-2fd3-489e-a22c-5d342a3c713d</hostUuid>
+          </brick>
         </bricks>
         <optCount>0</optCount>
         <options/>
@@ -97,9 +103,16 @@
         tree = etree.fromstring(out)
         oVolumeInfo = \
             {'music': {'brickCount': '2',
-                       'bricks': ['192.168.122.2:/tmp/music-b1',
-                                  '192.168.122.2:/tmp/music-b2'],
+                       'bricks': ['192.168.122.2:/tmp/m_b1',
+                                  '192.168.122.2:/tmp/m_b2'],
                        'distCount': '2',
+                       'bricksInfo': [{
+                           'name': '192.168.122.2:/tmp/m_b1',
+                           'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d'
+                       }, {
+                           'name': '192.168.122.2:/tmp/m_b2',
+                           'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d'
+                       }],
                        'options': {'auth.allow': '*'},
                        'replicaCount': '2',
                        'stripeCount': '1',
@@ -109,8 +122,12 @@
                        'volumeStatus': gcli.VolumeStatus.ONLINE,
                        'volumeType': 'REPLICATE'},
              'test1': {'brickCount': '1',
-                       'bricks': ['192.168.122.2:/tmp/test1-b1'],
+                       'bricks': ['192.168.122.2:/tmp/t_b1'],
                        'distCount': '1',
+                       'bricksInfo': [{
+                           'name': '192.168.122.2:/tmp/t_b1',
+                           'hostUuid': '04eb591b-2fd3-489e-a22c-5d342a3c713d'
+                       }],
                        'options': {},
                        'replicaCount': '1',
                        'stripeCount': '1',
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index d7f8984..5a090c5 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -355,10 +355,21 @@
             value['transportType'] = [TransportType.TCP, TransportType.RDMA]
         value['bricks'] = []
         value['options'] = {}
+        value['bricksInfo'] = []
         for b in el.findall('bricks/brick'):
             value['bricks'].append(b.text)
         for o in el.findall('options/option'):
             value['options'][o.find('name').text] = o.find('value').text
+        for d in el.findall('bricks/brick'):
+            brickDetail = {}
+            #this try block is to maintain backward compatibility
+            #it returns an empty list when gluster doesnot return uuid
+            try:
+                brickDetail['name'] = d.find('name').text
+                brickDetail['hostUuid'] = d.find('hostUuid').text
+                value['bricksInfo'].append(brickDetail)
+            except AttributeError:
+                break
         volumes[value['volumeName']] = value
     return volumes
 
diff --git a/vdsm/gluster/vdsmapi-gluster-schema.json b/vdsm/gluster/vdsmapi-gluster-schema.json
index 846d5e6..59b6623 100644
--- a/vdsm/gluster/vdsmapi-gluster-schema.json
+++ b/vdsm/gluster/vdsmapi-gluster-schema.json
@@ -504,6 +504,21 @@
  'data': ['TCP', 'RDMA']}
 
 ##
+# @BricksInfo:
+#
+# Bricks information.
+#
+# @name:    Name of the brick
+#
+# @hostUuid:   Uuid of the host on which brick lies.
+#
+# Since: 4.14.0
+##
+{'type': 'BricksInfo',
+ 'data': {'name': 'str', 'hostUuid': 'UUID'}}
+
+
+##
 # @VolumeInfo:
 #
 # volume information.
@@ -524,10 +539,12 @@
 #
 # @volumeType:    Type of the volume
 #
+# @bricksInfo:    details related to bricks(new in version 4.14.0)
+#
 # Since: 4.10.3
 ##
 {'type': 'VolumeInfo',
- 'data': {'brickCount': 'int', 'bricks': ['str'], 'options': ['str'], 'transportType': 'transType', 'uuid': 'UUID', 'volumeName': 'str', 'status': 'volumeStatus', 'volumeType': 'str'}}
+ 'data': {'brickCount': 'int', 'bricks': ['str'], 'options': ['str'], 'transportType': 'transType', 'uuid': 'UUID', 'volumeName': 'str', 'status': 'volumeStatus', 'volumeType': 'str', 'bricksInfo': ['BricksInfo']}}
 
 ##
 # @GlusterVolume.list:


-- 
To view, visit http://gerrit.ovirt.org/23438
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ed62e687feaae997d219ee1f5fcc6373f8c49c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Darshan N <dnarayan at redhat.com>
Gerrit-Reviewer: Aravinda VK <avishwan at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Sahina Bose <sabose at redhat.com>


More information about the vdsm-patches mailing list