Nir Soffer has uploaded a new change for review.
Change subject: fencing: Make getHostLeaseStatus API public ......................................................................
fencing: Make getHostLeaseStatus API public
Getting host lease status will allow engine to make smarter decisions when a host is non-responsive by using a proxy host to get the non-responsive host status.
See http://pastebin.com/KqqeAdSu for example output from this API.
Change-Id: I415c1fee6256bf8d4e03ee542cc58e193162e9b8 Signed-off-by: Nir Soffer nsoffer@redhat.com --- M client/vdsClient.py M vdsm/API.py M vdsm/rpc/BindingXMLRPC.py M vdsm/rpc/Bridge.py M vdsm/rpc/vdsmapi-schema.json 5 files changed, 62 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/29157/1
diff --git a/client/vdsClient.py b/client/vdsClient.py index 2c09b28..aea1503 100644 --- a/client/vdsClient.py +++ b/client/vdsClient.py @@ -1760,6 +1760,18 @@ status = self.s.stopMonitoringDomain(sdUUID) return status['status']['code'], status['status']['message']
+ def getHostLeaseStatus(self, args): + domains = {} + for pair in args: + sdUUID, hostId = pair.split('=', 1) + domains[sdUUID] = int(hostId) + response = self.s.getHostLeaseStatus(domains) + if response['status']['code']: + print "Cannot get host storage liveliness" + return response['status']['code'], response['status']['message'] + pp.pprint(response['domains']) + return 0, '' + def snapshot(self, args): vmUUID, sdUUID, imgUUID, baseVolUUID, volUUID = args
@@ -2579,6 +2591,11 @@ ('<sdUUID>', 'Stop monitoring SD: sdUUID' )), + 'getHostLeaseStatus': (serv.getHostLeaseStatus, + ('<sdUUID>=<hostId> [<sdUUID>=<hostId>] ...', + 'Returns host lease status for hostId on ' + 'each domain.' + )), 'snapshot': (serv.snapshot, ('<vmId> <sdUUID> <imgUUID> <baseVolUUID> <volUUID>', 'Take a live snapshot' diff --git a/vdsm/API.py b/vdsm/API.py index e739294..0b44459 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -1497,6 +1497,9 @@ def stopMonitoringDomain(self, sdUUID): return self._irs.stopMonitoringDomain(sdUUID)
+ def getHostLeaseStatus(self, domains): + return self._irs.getHostLeaseStatus(domains) + def getLVMVolumeGroups(self, storageType=None): return self._irs.getVGList(storageType)
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py index c1c7490..a06a3b4 100644 --- a/vdsm/rpc/BindingXMLRPC.py +++ b/vdsm/rpc/BindingXMLRPC.py @@ -917,6 +917,10 @@ api = API.Global() return api.stopMonitoringDomain(sdUUID)
+ def getHostLeaseStatus(self, domains, options=None): + api = API.Global() + return api.getHostLeaseStatus(domains) + def vgsGetList(self, storageType=None, options=None): api = API.Global() return api.getLVMVolumeGroups(storageType) @@ -1070,6 +1074,7 @@ (self.storageRepoGetStats, 'repoStats'), (self.startMonitoringDomain, 'startMonitoringDomain'), (self.stopMonitoringDomain, 'stopMonitoringDomain'), + (self.getHostLeaseStatus, 'getHostLeaseStatus'), (self.vgsGetList, 'getVGList'), (self.devicesGetList, 'getDeviceList'), (self.devicesGetVisibility, 'getDevicesVisibility'), diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py index 7e898de..ba700d1 100644 --- a/vdsm/rpc/Bridge.py +++ b/vdsm/rpc/Bridge.py @@ -349,6 +349,7 @@ 'Host_getStorageRepoStats': {'ret': Host_getStorageRepoStats_Ret}, 'Host_startMonitoringDomain': {}, 'Host_stopMonitoringDomain': {}, + 'Host_getHostLeaseStatus': {'ret': 'domains'}, 'Host_getVMList': {'call': Host_getVMList_Call, 'ret': Host_getVMList_Ret}, 'Host_getVMFullList': {'call': Host_getVMFullList_Call, 'ret': 'vmList'}, 'Host_getAllVmStats': {'ret': 'statsList'}, diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json index 0c8a6f6..7617185 100644 --- a/vdsm/rpc/vdsmapi-schema.json +++ b/vdsm/rpc/vdsmapi-schema.json @@ -2052,6 +2052,42 @@ 'returns': ''}
## +# @HostIdMap: +# +# A mapping of hostId indexed by domain UUID. +# +# Since: 4.15.0 +## +{'map': 'HostIdMap', + 'key': 'UUID', 'value': 'int'} + +## +# @HostLeaseStatusMap: +# +# A mapping of status codes indexed by domain UUID. +# +# Since: 4.15.0 +## +{'map': 'HostLeaseStatusMap', + 'key': 'UUID', 'value': 'str'} + +## +# @Host.getHostLeaseStatus: +# +# Returns host status for for specified domains +# +# @domains: A mapping of hostId indexed by domain UUID +# +# Returns: +# Host status code for each domain +# +# Since: 4.15.0 +## +{'command': {'class': 'Host', 'name': 'getHostLeaseStatus'}, + 'data': {'domains': 'HostIdMap'} + 'returns': {'domains': 'HostLeaseStatusMap'}} + +## # @VmStatus: # # An enumeration of possible virtual machine statuses.