Change in vdsm[ovirt-3.6]: clusterlock: Remove unneeded workaround
ishaby at redhat.com
ishaby at redhat.com
Sun Nov 15 10:06:22 UTC 2015
Idan Shaby has uploaded a new change for review.
Change subject: clusterlock: Remove unneeded workaround
......................................................................
clusterlock: Remove unneeded workaround
Sanlock 2.8 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 2.8-2.
Now we can use the hostId parameter, making the call more efficient and
simplifying clusterlock code.
Change-Id: Ide75e749fbc2916540c2b526b78fedc247b5c6f9
Bug-Url: https://bugzilla.redhat.com/1131192
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/74/48574/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 9d27b1e..28b7705 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -173,7 +173,7 @@
Requires: iscsi-initiator-utils >= 6.2.0.873-21
%endif
-Requires: sanlock >= 2.8, sanlock-python
+Requires: sanlock >= 2.8-2, sanlock-python
%if 0%{?rhel}
%if 0%{?centos}
diff --git a/vdsm/storage/clusterlock.py b/vdsm/storage/clusterlock.py
index 2a2effc..52b5c93 100644
--- a/vdsm/storage/clusterlock.py
+++ b/vdsm/storage/clusterlock.py
@@ -262,26 +262,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 https://gerrit.ovirt.org/48574
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide75e749fbc2916540c2b526b78fedc247b5c6f9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Idan Shaby <ishaby at redhat.com>
More information about the vdsm-patches
mailing list