Change in vdsm[master]: gluster: Verify volume is Replica 3

ahino at redhat.com ahino at redhat.com
Thu Jun 4 09:41:02 UTC 2015


Ala Hino has uploaded a new change for review.

Change subject: gluster: Verify volume is Replica 3
......................................................................

gluster: Verify volume is Replica 3

Verify that only Replica 3 volumes are used in gluster storage domains.

Change-Id: I1fee5d023706e2a0613201a9afef7d285b08442f
Signed-off-by: Ala Hino <ahino at redhat.com>
---
M vdsm/storage/storageServer.py
M vdsm/storage/storage_exception.py
2 files changed, 19 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/41931/1

diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index e057ea2..febf375 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -259,16 +259,25 @@
     DIR = "glusterSD"
 
     def connect(self):
-        glusterMountOptions = self._getGlusterMountOptions()
-        self._options += glusterMountOptions
-        super(GlusterFSConnection, self).connect()
-
-    def _getGlusterMountOptions(self):
         remotePath = self._remotePath.split(":/")
         glusterServer = remotePath[0]
         volume = remotePath[1]
         volInfo = supervdsm.getProxy().glusterVolumeInfo(volume,
                                                          glusterServer)
+
+        if not self._getReplicaType(volume, volInfo) == '3':
+            raise se.GlusterVolumeNotReplicaThreeException()
+
+        glusterMountOptions = self._getGlusterMountOptions(volume,
+                                                           glusterServer,
+                                                           volInfo)
+        self._options += glusterMountOptions
+        super(GlusterFSConnection, self).connect()
+
+    def _getReplicaType(self, volume, volInfo):
+        return volInfo[volume]['replicaCount']
+
+    def _getGlusterMountOptions(self, volume, glusterServer, volInfo):
         servers = self._getGlusterServers(volume, volInfo)
         servers.remove(glusterServer)
         return "backup-volfile-servers=%s:%s" % (servers[0], servers[1])
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 1cfc8e4..eea05b8 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -1196,6 +1196,11 @@
     message = "Connection Reference ID was not registered"
 
 
+class GlusterVolumeNotReplicaThreeException(StorageException):
+    code = 4710
+    message = "Only Gluster volume Replica 3 is supported"
+
+
 #################################################
 #  LVM related Exceptions
 #################################################


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1fee5d023706e2a0613201a9afef7d285b08442f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ala Hino <ahino at redhat.com>


More information about the vdsm-patches mailing list