Yeela Kaplan has uploaded a new change for review.
Change subject: [WIP] destroy storage pool using command type 1 ......................................................................
[WIP] destroy storage pool using command type 1
Change-Id: I67cda9abd0bbc01d7d0642d5d3327f8687d7f728 Signed-off-by: Yeela Kaplan ykaplan@redhat.com --- M vdsm/storage/blockSD.py M vdsm/storage/sd.py M vdsm/storage/sp.py 3 files changed, 29 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/24398/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index 799ee01..0bbe5dd 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -559,9 +559,9 @@ raise se.VolumesZeroingError(path)
if version in VERS_METADATA_LV: - md = LvBasedSDMetadata(vgName, sd.METADATA) + LvBasedSDMetadata(vgName, sd.METADATA) elif version in VERS_METADATA_TAG: - md = TagBasedSDMetadata(vgName) + TagBasedSDMetadata(vgName)
logBlkSize, phyBlkSize = lvm.getVGBlockSizes(vgName)
@@ -1327,10 +1327,10 @@ vgName = vg.name toAdd = encodeVgTags(leaseParams) toAdd += encodeVgTags({sd.DMDK_POOLS: spUUID, - sd.DMDK_ROLE: sd.MASTER_DOMAIN}) + sd.DMDK_ROLE: sd.MASTER_DOMAIN}) toDel = encodeVgTags({sd.DMDK_ROLE: sd.REGULAR_DOMAIN, - sd.DMDK_POOLS: spUUID, - sd.DMDK_POOLS: ''}) + sd.DMDK_POOLS: spUUID, + sd.DMDK_POOLS: ''}) lvm.changeVGTags(vgName, delTags=toDel, addTags=toAdd, safe=False)
def refreshDirTree(self): @@ -1357,6 +1357,26 @@ finally: self._extendlock.release()
+ def detachMaster(self, spUUID): + self.invalidateMetadata() + pools = self.getPools() + try: + pools.remove(spUUID) + except ValueError: + self.log.error( + "Can't remove pool %s from domain %s pool list %s, " + "it does not exist", + spUUID, self.sdUUID, str(pools)) + return + vgUUID = self.getInfo()['vguuid'] + vg = lvm.getVGbyUUID(vgUUID) + vgName = vg.name + toAdd = encodeVgTags({sd.DMDK_POOLS: '', + sd.DMDK_ROLE: sd.REGULAR_DOMAIN}) + toDel = encodeVgTags({sd.DMDK_POOLS: spUUID, + sd.DMDK_ROLE: sd.MASTER_DOMAIN}) + lvm.changeVGTags(vgName, delTags=toDel, addTags=toAdd, safe=False) + def refresh(self): self.refreshDirTree() lvm.invalidateVG(self.sdUUID) diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index 23ca112..6849545 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -524,6 +524,9 @@ # Last thing to do is to remove pool from domain # do any required cleanup
+ def detachMaster(self, spUUID): + self.detach(spUUID) + # I personally don't think there is a reason to pack these # but I already changed too much. def changeLeaseParams(self, leaseParamPack): diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index d228a9d..6ec941d 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -963,7 +963,7 @@
# Forced detach master domain self.forcedDetachSD(self.masterDomain.sdUUID) - self.masterDomain.detach(self.spUUID) + self.masterDomain.detachMaster(self.spUUID)
@unsecured def _convertDomain(self, domain, targetFormat=None):
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] destroy storage pool using command type 1 ......................................................................
Patch Set 1: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6326/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7216/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7109/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] destroy storage pool using command type 1 ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6326/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7216/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7110/ : SUCCESS
Eduardo has posted comments on this change.
Change subject: [WIP] destroy storage pool using command type 1 ......................................................................
Patch Set 1: Code-Review-1
(3 comments)
http://gerrit.ovirt.org/#/c/24398/1/vdsm/storage/blockSD.py File vdsm/storage/blockSD.py:
Line 1366: self.log.error( Line 1367: "Can't remove pool %s from domain %s pool list %s, " Line 1368: "it does not exist", Line 1369: spUUID, self.sdUUID, str(pools)) Line 1370: return Use an else: block please instead this ugly return. Line 1371: vgUUID = self.getInfo()['vguuid'] Line 1372: vg = lvm.getVGbyUUID(vgUUID) Line 1373: vgName = vg.name Line 1374: toAdd = encodeVgTags({sd.DMDK_POOLS: '',
Line 1369: spUUID, self.sdUUID, str(pools)) Line 1370: return Line 1371: vgUUID = self.getInfo()['vguuid'] Line 1372: vg = lvm.getVGbyUUID(vgUUID) Line 1373: vgName = vg.name This block (3 lines) seems to me to be an echo from code a long time gone.
vgName is self.sdUUID.
Please remove this redundant calls. Line 1374: toAdd = encodeVgTags({sd.DMDK_POOLS: '', Line 1375: sd.DMDK_ROLE: sd.REGULAR_DOMAIN}) Line 1376: toDel = encodeVgTags({sd.DMDK_POOLS: spUUID, Line 1377: sd.DMDK_ROLE: sd.MASTER_DOMAIN})
Line 1374: toAdd = encodeVgTags({sd.DMDK_POOLS: '', Line 1375: sd.DMDK_ROLE: sd.REGULAR_DOMAIN}) Line 1376: toDel = encodeVgTags({sd.DMDK_POOLS: spUUID, Line 1377: sd.DMDK_ROLE: sd.MASTER_DOMAIN}) Line 1378: lvm.changeVGTags(vgName, delTags=toDel, addTags=toAdd, safe=False) Since detachMaster is called only from hsm.destroyStoragePool() and the domain was already removed from the pool MD, you can avoid here the use of changeVGtags replacing it by addVGTags and remVGTags as was discussed in a previous patch.
The operations will be logically atomic and no one should try ever to access the domain between the removal and the adiditon of the role tag.
You can lock the master domain at hsm.destroyStoragePool() to be sure and this covers the previous forceDetach() call. Line 1379: Line 1380: def refresh(self): Line 1381: self.refreshDirTree() Line 1382: lvm.invalidateVG(self.sdUUID)
Eduardo has posted comments on this change.
Change subject: [WIP] destroy storage pool using command type 1 ......................................................................
Patch Set 1:
After review the engine part: 1) all the regular domains are detached and removed. 2) destroy StoragePool is sent and afterwards the former master domain is removed.
Therefore this patch can be greatly simplified if the MSD is removed when the pool is destroyed in a unique lvm operation.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] destroy storage pool using command type 1 ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6477/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7261/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7379/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6482/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7266/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7384/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6499/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7283/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7401/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 5:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6506/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7290/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7408/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 6:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6798/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7588/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7698/ : FAILURE
oVirt Jenkins CI Server has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 7:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6937/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7727/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7839/ : FAILURE
Douglas Schilling Landgraf has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 7: Code-Review-1
./vdsm/storage/hsm.py:43: 'MAX_DOMAINS' imported but unused
Itamar Heim has posted comments on this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Patch Set 7:
ping
Itamar Heim has abandoned this change.
Change subject: destroy storage pool using command type 1 ......................................................................
Abandoned
no activity. please restore if/when still relevant.
vdsm-patches@lists.fedorahosted.org