Change in vdsm[master]: clusterlock: Remove uneeded workaround

nsoffer at redhat.com nsoffer at redhat.com
Wed Aug 6 18:01:28 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: clusterlock: Remove uneeded workaround
......................................................................

clusterlock: Remove uneeded workaround

Sanlock version XXXX had a off-by-one bug when calling get_hosts with a
host id, returning info for the next host. This bug is fixed in version
XXX. Now we can use the hostId parameter, making the call more efficient
and simpligying clusterlock code.

Change-Id: Ide75e749fbc2916540c2b526b78fedc247b5c6f9
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm.spec.in
M vdsm/storage/clusterlock.py
2 files changed, 5 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/31162/1

diff --git a/vdsm.spec.in b/vdsm.spec.in
index 5ba6fc6..fc39eb9 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -167,7 +167,7 @@
 Requires: iscsi-initiator-utils >= 6.2.0.873-21
 %endif
 
-Requires: sanlock >= 2.8, sanlock-python
+Requires: sanlock >= XXX, sanlock-python
 
 %if 0%{?rhel}
 Requires: python-ethtool >= 0.6-3
diff --git a/vdsm/storage/clusterlock.py b/vdsm/storage/clusterlock.py
index 24a5d81..17cdd53 100644
--- a/vdsm/storage/clusterlock.py
+++ b/vdsm/storage/clusterlock.py
@@ -265,26 +265,15 @@
                 return False
 
     def getHostStatus(self, hostId):
-        # Note: get_hosts has off-by-one bug when asking for particular host
-        # id, so get all hosts info and filter.
-        # See https://bugzilla.redhat.com/1111210
         try:
-            hosts = sanlock.get_hosts(self._sdUUID)
+            hosts = sanlock.get_hosts(self._sdUUID, hostId)
         except sanlock.SanlockException as e:
             self.log.debug("Unable to get host %d status in lockspace %s: %s",
                            hostId, self._sdUUID, e)
             return HOST_STATUS_UNAVAILABLE
-
-        for info in hosts:
-            if info['host_id'] == hostId:
-                status = info['flags']
-                return self.STATUS_NAME[status]
-
-        # get_hosts with host_id=0 returns only hosts with timestamp != 0,
-        # which means that no host is using this host id now. If there a
-        # timestamp, sanlock will return HOST_UNKNOWN and then HOST_LIVE or
-        # HOST_FAIL.
-        return HOST_STATUS_FREE
+        else:
+            status = hosts[0]['flags']
+            return self.STATUS_NAME[status]
 
     # The hostId parameter is maintained here only for compatibility with
     # ClusterLock. We could consider to remove it in the future but keeping it


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide75e749fbc2916540c2b526b78fedc247b5c6f9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list