Change in vdsm[master]: gluster: Don't fail connect server when getting volume info`

ahino at redhat.com ahino at redhat.com
Mon Feb 22 10:22:51 UTC 2016


Ala Hino has uploaded a new change for review.

Change subject: gluster: Don't fail connect server when getting volume info`
......................................................................

gluster: Don't fail connect server when getting volume info`

When connecting to gluster server, we check volume info in order to validate
replica count. However, if gluster server is not available, we get an
exception and fail the operation. This patch cathes the thrown exception and
logs a warning message indicating that we got error when tried to connect to
gluster server.

Change-Id: I0e1835b7de4c5c4c5c4616d3c36f15c1f91a01dc
Bug-Url: https://bugzilla.redhat.com/1303977
Signed-off-by: Ala Hino <ahino at redhat.com>
---
M vdsm/storage/storageServer.py
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/53785/1

diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 38ed710..29ebaaf 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -44,6 +44,7 @@
 from sync import asyncmethod, AsyncCallStub
 from mount import MountError
 import gluster.cli
+import gluster.exception as ge
 import storage_exception as se
 
 
@@ -346,6 +347,9 @@
                              "servers")
             return
 
+        if self.volinfo is None:
+            return
+
         replicaCount = self.volinfo['replicaCount']
         if replicaCount not in self.ALLOWED_REPLICA_COUNTS:
             self.log.warning("Unsupported replica count (%s) for volume %r, "
@@ -369,9 +373,15 @@
         return "backup-volfile-servers=" + ":".join(servers)
 
     def _get_gluster_volinfo(self):
-        volinfo = supervdsm.getProxy().glusterVolumeInfo(self._volname,
-                                                         self._volfileserver)
-        return volinfo[self._volname]
+        try:
+            superVdsmProxy = supervdsm.getProxy()
+            volinfo = superVdsmProxy.glusterVolumeInfo(self._volname,
+                                                       self._volfileserver)
+            return volinfo[self._volname]
+        except ge.GlusterCmdExecFailedException:
+            self.log.warning("Failed to get volume info. Please check if "
+                             "gluster daemon is operational on %r.",
+                             self._volfileserver)
 
 
 class NFSConnection(object):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e1835b7de4c5c4c5c4616d3c36f15c1f91a01dc
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