Federico Simoncelli has uploaded a new change for review. Change subject: sp: move reconnection info check to StoragePool ......................................................................
sp: move reconnection info check to StoragePool The entire reconnection info logic belongs to the StoragePool class. Change-Id: Ia57afc04db02b6c15633d09349a55b3ff5ae7fda Signed-off-by: Federico Simoncelli <[email protected]> --- M vdsm/storage/hsm.py M vdsm/storage/sp.py 2 files changed, 11 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/21424/1 diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index 5e53f3a..68bb4ca 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -1056,9 +1056,8 @@ return pool = sp.StoragePool(spUUID, self.domainMonitor, self.taskMng) - if not hostID or not scsiKey or not msdUUID or not masterVersion: - hostID, scsiKey, msdUUID, masterVersion = pool.getPoolParams() res = pool.connect(hostID, scsiKey, msdUUID, masterVersion) + if res: self.pools[spUUID] = pool for callback in self.domainStateChangeCallbacks: diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index 0e23e1d..bf49b79 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -677,6 +677,12 @@ "domain: %s (ver = %s)" % (hostID, self.spUUID, msdUUID, masterVersion)) + if not hostID or not scsiKey or not msdUUID or not masterVersion: + hostID, scsiKey, msdUUID, masterVersion = self.getPoolParams() + self.log.info("Using saved connection parameters: hostID=%s" + "scsiKey=%s, msdUUID=%s, masterVersion=%s", + hostID, scsiKey, msdUUID, masterVersion) + if not os.path.exists(self._poolsTmpDir): msg = ("StoragePoolConnectionError for hostId: %s, on poolId: %s," " Pools temp data dir: %s does not exist" % @@ -732,21 +738,10 @@ @unsecured def getPoolParams(self): - file = open(self._poolFile, "r") - for line in file: - pair = line.strip().split("=") - if len(pair) == 2: - if pair[0] == "id": - hostId = int(pair[1]) - elif pair[0] == "scsiKey": - scsiKey = pair[1] - elif pair[0] == "sdUUID": - msdUUID = pair[1] - elif pair[0] == "version": - masterVersion = pair[1] - file.close() - - return hostId, scsiKey, msdUUID, masterVersion + with open(self._poolFile, "r") as f: + poolInfo = dict((x.strip().split("=", 1) for x in f)) + return tuple(poolInfo.get(x) for x in + ("hostId", "scsiKey", "msdUUID", "masterVersion")) @unsecured def createMaster(self, poolName, domain, masterVersion, leaseParams): -- To view, visit http://gerrit.ovirt.org/21424 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia57afc04db02b6c15633d09349a55b3ff5ae7fda Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
