Federico Simoncelli has uploaded a new change for review. Change subject: client: add the domainsMap in connectStoragePool ......................................................................
client: add the domainsMap in connectStoragePool Change-Id: I5c3037456ac045b7ac03043bb2f46ccd48b67045 Signed-off-by: Federico Simoncelli <fsimo...@redhat.com> --- M client/vdsClient.py 1 file changed, 26 insertions(+), 22 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/24491/1 diff --git a/client/vdsClient.py b/client/vdsClient.py index 3868c6e..1b2c71a 100644 --- a/client/vdsClient.py +++ b/client/vdsClient.py @@ -822,15 +822,18 @@ return res['status']['code'], res['status']['message'] return 0, '' + def _parseDomainsMap(self, domMapString): + """ + Parse domains map string: "sdUUID1=status1,sdUUID2=status2,..." + into a dictionary: {'sdUUID1': 'status1', 'sdUUID2': 'status2', ...} + """ + return dict(x.split("=", 1) for x in domMapString.split(',')) + def reconstructMaster(self, args): spUUID = args[0] poolName = args[1] masterDom = args[2] - domList = args[3].split(",") - domDict = {} - for item in domList: - key, value = item.split('=') - domDict[key] = value + domDict = self._parseDomainsMap(args[3]) mVer = int(args[4]) if len(args) > 5: st = self.s.reconstructMaster(spUUID, poolName, masterDom, domDict, @@ -875,18 +878,20 @@ spUUID = args[0] ID = int(args[1]) scsi_key = args[2] - if len(args) > 3: - master = args[3] + master = args[3] if len(args) > 3 else BLANK_UUID + master_ver = int(args[4]) if len(args) > 4 else -1 + + if len(args) > 5: + domainsMap = self._parseDomainsMap(args[5]) + pool = self.s.connectStoragePool( + spUUID, ID, scsi_key, master, master_ver, domainsMap) else: - master = BLANK_UUID - if len(args) > 4: - master_ver = int(args[4]) - else: - master_ver = -1 - pool = self.s.connectStoragePool(spUUID, ID, scsi_key, - master, master_ver) + pool = self.s.connectStoragePool( + spUUID, ID, scsi_key, master, master_ver) + if pool['status']['code']: return pool['status']['code'], pool['status']['message'] + return 0, '' def disconnectStoragePool(self, args): @@ -2145,14 +2150,13 @@ 'only for the command line backward ' 'compatibility)' )), - 'connectStoragePool': (serv.connectStoragePool, - ('<spUUID> <id> <scsi-key> [masterUUID] ' - '[masterVer]', - 'Connect a Host to specific storage pool', - 'Parameter scsi-key is ignored (maintained ' - 'only for the command line backward ' - 'compatibility)' - )), + 'connectStoragePool': (serv.connectStoragePool, ( + '<spUUID> <id> <scsi-key> [masterUUID] [masterVer] ' + '[<domDict>({sdUUID1=status,sdUUID2=status,...})]', + 'Connect a Host to specific storage pool', + 'Parameter scsi-key is ignored (maintained only for the command ' + 'line backward compatibility)' + )), 'disconnectStoragePool': (serv.disconnectStoragePool, ('<spUUID> <id> <scsi-key>', 'Disconnect a Host from the specific ' -- To view, visit http://gerrit.ovirt.org/24491 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c3037456ac045b7ac03043bb2f46ccd48b67045 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches