Last active
December 23, 2015 15:49
-
-
Save ficoos/6657930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classmethod | |
def isPoolConnected(spUUID): | |
return spUUID in cls.pools | |
def _checkDomainPoolRelationship(self, domainInfo): | |
"""Performs sanity checks about dmoain<->pool relationship | |
Returns true if all checks succeeded or false if they didn't | |
""" | |
rolse = info['role'] | |
if role == sd.MASTER_DOMAIN: | |
sdUUID = info['sdUUID'] | |
pools = info['pool'] | |
if len(pools) == 0: | |
self.log.error("Domain %s is marked as master but is not " | |
"attached to any pool", sdUUID, exc_info=True) | |
return False | |
spUUID = pools[0] | |
conenctedPool = self.getPool(spUUID) | |
if not self.isPoolConnected(spUUID): | |
self.log.error("Domain %s, marked as master, is attached to " | |
"pool %s but this host is connected to pool %s", | |
sdUUID, spUUID, connectedPool.spUUID | |
exc_info=True) | |
return False | |
if conenctedPool.masterDomain.sdUUID != sdUUID: | |
self.log.error("Domain %s is marked as master but actual " | |
"master is %s", | |
sdUUID, pool.masterDomain.sdUUID) | |
return False | |
return True | |
@public | |
def getStorageDomainInfo(self, sdUUID, options=None): | |
<snip> | |
role = info['role'] | |
if role == sd.MASTER_DOMAIN and self._checkDomainPoolRelationship(info): | |
spUUID = info['pool'][0] | |
poolInfo = self.getPool(spUUID).getInfo() | |
for key in ('lver', 'spm_id', 'master_ver'): | |
info[key] = poolInfo['info'][key] | |
<snip> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment