Change in vdsm[ovirt-3.6]: gluster: Fixing connection when server is not one of the bricks

ahino at redhat.com ahino at redhat.com
Mon Nov 23 10:58:22 UTC 2015


Hello Sahina Bose,

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

    https://gerrit.ovirt.org/48969

to review the following change.

Change subject: gluster: Fixing connection when server is not one of the bricks
......................................................................

gluster: Fixing connection when server is not one of the bricks

When processing gluster connection info, volfileserver is set as provided by
the admin and, using volume info, backup-volfile-servers option is set. However,
there are use cases where gluster server and ovirt are configured differently
regarding ip addresses and domain names. If volfileserver appears in volume
info, it is removed in order to avoid mounting duplicate servers, otherwise,
mounting duplicate servers is possible.

Change-Id: Id3386b37cd407c52e1b8f38d54c236bffc143e2f
Bug-Url: https://bugzilla.redhat.com/1278880
Signed-off-by: Ala Hino <ahino at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/48308
Continuous-Integration: Jenkins CI
Reviewed-by: Sahina Bose <sabose at redhat.com>
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
---
M tests/storageServerTests.py
M vdsm/storage/storageServer.py
2 files changed, 27 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/48969/1

diff --git a/tests/storageServerTests.py b/tests/storageServerTests.py
index 6abd427..f39fe82 100644
--- a/tests/storageServerTests.py
+++ b/tests/storageServerTests.py
@@ -149,6 +149,25 @@
                           "backup-volfile-servers=192.168.122.2:192.168.122.3")
 
     @MonkeyPatch(storageServer, 'supervdsm', FakeSupervdsm())
+    def test_server_not_in_volinfo(self):
+        """
+        This test simulates a use case where gluster server provided in the
+        path doesn't appear in the volume info.
+        """
+        def glusterVolumeInfo(volname=None, volfileServer=None):
+            return {'music': {'brickCount': '3',
+                              'bricks': ['192.168.122.5:/tmp/music',
+                                         '192.168.122.2:/tmp/music',
+                                         '192.168.122.3:/tmp/music']}}
+
+        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo
+
+        gluster = GlusterFSConnection(spec="gluster-server:/music")
+        expected_backup_servers = \
+            "backup-volfile-servers=192.168.122.5:192.168.122.2:192.168.122.3"
+        self.assertEquals(gluster.options, expected_backup_servers)
+
+    @MonkeyPatch(storageServer, 'supervdsm', FakeSupervdsm())
     def test_gluster_and_user_provided_mount_options(self):
         def glusterVolumeInfo(volname=None, volfileServer=None):
             return {'music': {'brickCount': '3',
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index c321942..4385889 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -337,7 +337,14 @@
 
     def _get_backup_servers_option(self):
         servers = [brick.split(":")[0] for brick in self.volinfo['bricks']]
-        servers.remove(self._volfileserver)
+        self.log.debug("Using bricks: %s", servers)
+        if self._volfileserver in servers:
+            servers.remove(self._volfileserver)
+        else:
+            self.log.warning("gluster server %r is not in bricks %s, possibly "
+                             "mounting duplicate servers",
+                             self._volfileserver, servers)
+
         if not servers:
             return ""
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3386b37cd407c52e1b8f38d54c236bffc143e2f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Ala Hino <ahino at redhat.com>
Gerrit-Reviewer: Sahina Bose <sabose at redhat.com>


More information about the vdsm-patches mailing list