Change in vdsm[ovirt-3.3]: Fix getStorageDomainInfo() logic.
fsimonce at redhat.com
fsimonce at redhat.com
Tue Oct 15 19:10:55 UTC 2013
Hello Ayal Baron, Eduardo,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/20209
to review the following change.
Change subject: Fix getStorageDomainInfo() logic.
......................................................................
Fix getStorageDomainInfo() logic.
Domains with 'role' == MASTER_DOMAIN should always be attached
to a pool.
Detect 'stale' master domains.
Not hiding errors anymore.
Catching specific errors.
BC: If the domain is a Master but it is not connected to the actual
(host) pool, master_ver, host_id and lver are not returned.
Required for making repoStats pool independent.
Change-Id: I8b0b2ad3dca19cf203d937c1a9f6a12ab0f1095f
Signed-off-by: Eduardo <ewarszaw at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/14671
Reviewed-by: Ayal Baron <abaron at redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 21 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/20209/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 061182d..d46ef50 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2737,17 +2737,29 @@
# BC) so it's not that horrible. In any case please
# remove this when we can stop supporting this API.
info.update({'lver': -1, 'spm_id': -1, 'master_ver': 0})
- if dom.getDomainRole() == sd.MASTER_DOMAIN:
- # make sure it's THE master
+ if info['role'] == sd.MASTER_DOMAIN:
try:
- pool = self.getPool(dom.getPools()[0])
- if pool.masterDomain.sdUUID == sdUUID:
- poolInfo = pool.getInfo()
- for key in ['lver', 'spm_id', 'master_ver']:
- info[key] = poolInfo['info'][key]
+ # Verify that the host is connected to the same pool which
+ # the SD is attached to.
+ pool = self.getPool(info['pool'][0])
+ except IndexError:
+ self.log.error("Domain %s is marked as master but is not "
+ "attached to any pool", sdUUID)
except se.StoragePoolUnknown:
- # Its pool is not connected
- pass
+ current = self.pools.keys()[0].spUUID if self.pools else None
+ self.log.error("Domain %s, marked as master, is attached to "
+ "pool %s but this host is connected to pool %s",
+ sdUUID, info['pool'], current, exc_info=True)
+ else:
+ # make sure it's THE master of this pool
+ if pool.masterDomain.sdUUID != sdUUID:
+ self.log.warn("Domain %s is marked as master but actual "
+ "master is %s",
+ sdUUID, pool.masterDomain.sdUUID)
+ else:
+ poolInfo = pool.getInfo()
+ for key in ('lver', 'spm_id', 'master_ver'):
+ info[key] = poolInfo[key]
return dict(info=info)
--
To view, visit http://gerrit.ovirt.org/20209
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b0b2ad3dca19cf203d937c1a9f6a12ab0f1095f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw at redhat.com>
More information about the vdsm-patches
mailing list