Federico Simoncelli has uploaded a new change for review.
Change subject: vm: discover volume path from xml definition ......................................................................
vm: discover volume path from xml definition
In a previous commit (c072945 One shot prepare) we involuntarily changed the path used for virtual machine images from:
/rhev/data-center/<spUUID>/<sdUUID>/images/<imgUUID>/<volUUID>
to:
/rhev/data-center/mnt/blockSD/<sdUUID>/images/<imgUUID>/<volUUID>
This generated an issue during live migration between different vdsm versions:
libvirtError: invalid argument: invalid path ... not assigned to domain
In this patch:
- revert to the previous path for virtual machine images - inspect libvirt xml during live migration and vdsm restart to identify if it is necessary to update the path cached in the drive object (provided by prepareImage)
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1059482 Change-Id: I322f1f879fbd5b6415789f3b307e8741d846d694 Signed-off-by: Federico Simoncelli fsimonce@redhat.com --- M vdsm/storage/blockSD.py M vdsm/storage/fileSD.py M vdsm/storage/hsm.py M vdsm/storage/sd.py M vdsm/vm.py 5 files changed, 25 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/24202/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index 5179c5a..9d76c2c 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -1052,9 +1052,8 @@ vols, rems = self.getAllVolumesImages() return rems
- def linkBCImage(self, imgPath, imgUUID): - dst = os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES, - imgUUID) + def linkBCImage(self, imgUUID, imgPath): + dst = sd.StorageDomain.linkBCImage(self, imgUUID, imgPath) try: os.symlink(imgPath, dst) except OSError as e: diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index 180a43f..50caa09 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -421,10 +421,6 @@ return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent'])) for k, v in volumes.iteritems())
- def linkBCImage(self, imgPath, imgUUID): - return os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES, - imgUUID) - def createImageLinks(self, srcImgPath, imgUUID): """ qcow chain is build by reading each qcow header and reading the path diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index 53c9dd0..384d43f 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -3220,7 +3220,7 @@ imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys() imgPath = dom.activateVolumes(imgUUID, imgVolumes) if spUUID and spUUID != sd.BLANK_UUID: - runImgPath = dom.linkBCImage(imgPath, imgUUID) + runImgPath = dom.linkBCImage(imgUUID, imgPath) else: runImgPath = imgPath
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index c9738e0..38ec5af 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -25,6 +25,7 @@ from collections import namedtuple import codecs
+import image import storage_exception as se import misc import resourceFactories @@ -643,6 +644,10 @@ # If it has a repo we don't have multiple domains. Assume single pool return os.path.join(self.storage_repository, self.getPools()[0])
+ def linkBCImage(self, imgUUID, imgPath): + return image.Image(self._getRepoPath()) \ + .getImageDir(self.sdUUID, imgUUID) + def getIsoDomainImagesDir(self): """ Get 'images' directory from Iso domain diff --git a/vdsm/vm.py b/vdsm/vm.py index aae8bd6..78161d1 100644 --- a/vdsm/vm.py +++ b/vdsm/vm.py @@ -4962,6 +4962,16 @@
self.log.debug('Looking for drive with attributes %s', deviceDict) for d in self._devices[DISK_DEVICES]: + # When we analyze a disk device that was already discovered in + # the past (generally as soon as the VM is created) we should + # verify that the cached path is the one used in libvirt. + # We already hit few times the problem that after a live + # migration the paths were not in sync anymore (BZ#1059482). + if (hasattr(d, 'alias') and d.alias == alias + and d.path != devPath): + self.log.warning('updating drive %s path from %s to %s', + d.alias, d.path, devPath) + d.path = devPath if d.path == devPath: d.name = name d.type = devType @@ -4975,6 +4985,13 @@ # Update vm's conf with address for known disk devices knownDev = False for dev in self.conf['devices']: + # See comment in previous loop. This part is used to update + # the vm configuration as well. + if ('alias' in dev and dev['alias'] == alias + and dev['path'] != devPath): + self.log.warning('updating drive %s config path from %s ' + 'to %s', dev['alias'], d.path, devPath) + dev['path'] = devPath if dev['type'] == DISK_DEVICES and dev['path'] == devPath: dev['name'] = name dev['address'] = address
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6247/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7137/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_storage_functional_tests_localfs/127/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_storage_functional_tests_nfs/66/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7026/ : SUCCESS
Sergey Gotliv has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1:
(1 comment)
http://gerrit.ovirt.org/#/c/24202/1/vdsm/storage/hsm.py File vdsm/storage/hsm.py:
Line 3219: # Filter volumes related to this image Line 3220: imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys() Line 3221: imgPath = dom.activateVolumes(imgUUID, imgVolumes) Line 3222: if spUUID and spUUID != sd.BLANK_UUID: Line 3223: runImgPath = dom.linkBCImage(imgUUID, imgPath) This change is not really required... Line 3224: else: Line 3225: runImgPath = imgPath Line 3226: Line 3227: leafPath = os.path.join(runImgPath, leafUUID)
Vinzenz Feenstra has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Event though I think this would have deserved two patches
http://gerrit.ovirt.org/#/c/24202/1/vdsm/storage/hsm.py File vdsm/storage/hsm.py:
Line 3219: # Filter volumes related to this image Line 3220: imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys() Line 3221: imgPath = dom.activateVolumes(imgUUID, imgVolumes) Line 3222: if spUUID and spUUID != sd.BLANK_UUID: Line 3223: runImgPath = dom.linkBCImage(imgUUID, imgPath)
This change is not really required...
The order was changed, so to me this seems to be required Line 3224: else: Line 3225: runImgPath = imgPath Line 3226: Line 3227: leafPath = os.path.join(runImgPath, leafUUID)
Sergey Gotliv has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1:
(1 comment)
http://gerrit.ovirt.org/#/c/24202/1/vdsm/storage/hsm.py File vdsm/storage/hsm.py:
Line 3219: # Filter volumes related to this image Line 3220: imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys() Line 3221: imgPath = dom.activateVolumes(imgUUID, imgVolumes) Line 3222: if spUUID and spUUID != sd.BLANK_UUID: Line 3223: runImgPath = dom.linkBCImage(imgUUID, imgPath)
The order was changed, so to me this seems to be required
I see that the order was changed :-). The question is why? This file can stay unchanged if the old order will be restored :-). Line 3224: else: Line 3225: runImgPath = imgPath Line 3226: Line 3227: leafPath = os.path.join(runImgPath, leafUUID)
Federico Simoncelli has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1:
(1 comment)
http://gerrit.ovirt.org/#/c/24202/1/vdsm/storage/hsm.py File vdsm/storage/hsm.py:
Line 3219: # Filter volumes related to this image Line 3220: imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys() Line 3221: imgPath = dom.activateVolumes(imgUUID, imgVolumes) Line 3222: if spUUID and spUUID != sd.BLANK_UUID: Line 3223: runImgPath = dom.linkBCImage(imgUUID, imgPath)
I see that the order was changed :-). The question is why?
Yeah sorry for this, I changed the order because the required argument here is imgUUID. The additional imgPath argument is in the interface only to satisfy one of the specific implementations (block domains). I think we can plan to remove it later on. I'll try to add a comment on this in the commit message. Line 3224: else: Line 3225: runImgPath = imgPath Line 3226: Line 3227: leafPath = os.path.join(runImgPath, leafUUID)
Sergey Gotliv has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1: Code-Review+1
Martin Polednik has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1: Code-Review+1
Francesco Romani has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1: Code-Review+1
Looks good, and just for the record I agree the optimal solution would have been to have two patches.
Dan Kenigsberg has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1:
(2 comments)
http://gerrit.ovirt.org/#/c/24202/1//COMMIT_MSG Commit Message:
Line 22: domain Line 23: Line 24: In this patch: Line 25: Line 26: - revert to the previous path for virtual machine images Is this really necessary? could you explain why? I think that the former change was not inadvertent - it was an attempt to remove a reference to the pool. Line 27: - inspect libvirt xml during live migration and vdsm restart to Line 28: identify if it is necessary to update the path cached in the Line 29: drive object (provided by prepareImage) Line 30:
http://gerrit.ovirt.org/#/c/24202/1/vdsm/vm.py File vdsm/vm.py:
Line 4980: d.address = address Line 4981: d.readonly = readonly Line 4982: if bootOrder: Line 4983: d.bootOrder = bootOrder Line 4984: self.log.debug('Matched %s', mergeDicts(deviceDict, d)) imo, the previous added block would have been slightly more readable on an "elif" block here. Line 4985: # Update vm's conf with address for known disk devices Line 4986: knownDev = False Line 4987: for dev in self.conf['devices']: Line 4988: # See comment in previous loop. This part is used to update
Federico Simoncelli has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 1:
(2 comments)
http://gerrit.ovirt.org/#/c/24202/1//COMMIT_MSG Commit Message:
Line 22: domain Line 23: Line 24: In this patch: Line 25: Line 26: - revert to the previous path for virtual machine images
Is this really necessary? could you explain why? I think that the former ch
If it was intentional it should have been explicitly stated in the commit message so we could have discussed it before reaching this issue. Patch was:
There's nothing backward compatible in changing the image path.
More over if you want run independently from the pool the correct way to do it is sending spUUID=BLANK_UUID (as introduced by the same patch).
I will add a note on why we should revert. Line 27: - inspect libvirt xml during live migration and vdsm restart to Line 28: identify if it is necessary to update the path cached in the Line 29: drive object (provided by prepareImage) Line 30:
http://gerrit.ovirt.org/#/c/24202/1/vdsm/vm.py File vdsm/vm.py:
Line 4980: d.address = address Line 4981: d.readonly = readonly Line 4982: if bootOrder: Line 4983: d.bootOrder = bootOrder Line 4984: self.log.debug('Matched %s', mergeDicts(deviceDict, d))
imo, the previous added block would have been slightly more readable on an
That would have been wrong, point of updating the path is to check if we're able to match it at 4975. Line 4985: # Update vm's conf with address for known disk devices Line 4986: knownDev = False Line 4987: for dev in self.conf['devices']: Line 4988: # See comment in previous loop. This part is used to update
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6283/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7173/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7062/ : SUCCESS
Dan Kenigsberg has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 2:
(1 comment)
http://gerrit.ovirt.org/#/c/24202/2//COMMIT_MSG Commit Message:
Line 22: domain Line 23: Line 24: In this patch: Line 25: Line 26: - revert to the previous path for virtual machine images An explanation on the need to revert was not added.
But since this reversal is going to be just as harmful for current ovirt-3.3.1 users, as keeping the current path is for ovirt-3.3.0 upgrading, I am not sure that we should take that path.
How about splitting this to a different patch, and considering to use it only on systems with a big fleet of running vm that use the /rhev/dc/spUUID path. Line 27: - inspect libvirt xml during live migration and vdsm restart to Line 28: identify if it is necessary to update the path cached in the Line 29: drive object (provided by prepareImage) Line 30:
Ayal Baron has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 2: Code-Review+2
Federico Simoncelli has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 3: Verified+1
Verified: live migration and vdsm restart both for block and file domains.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6297/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7187/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7076/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6300/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7190/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7079/ : SUCCESS
Federico Simoncelli has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 4: Verified+1
Patch was only split.
Dan Kenigsberg has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 4: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: vm: discover volume path from xml definition ......................................................................
vm: discover volume path from xml definition
In a previous commit (c072945 One shot prepare) we involuntarily changed the path used for virtual machine images from:
/rhev/data-center/<spUUID>/<sdUUID>/images/<imgUUID>/<volUUID>
to:
/rhev/data-center/mnt/blockSD/<sdUUID>/images/<imgUUID>/<volUUID>
This generated an issue during live migration between different vdsm versions:
libvirtError: invalid argument: invalid path ... not assigned to domain
In this patch we inspect libvirt xml during live migration and vdsm restart to identify if it is necessary to update the path cached in the drive object (provided by prepareImage).
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1059482 Change-Id: I322f1f879fbd5b6415789f3b307e8741d846d694 Signed-off-by: Federico Simoncelli fsimonce@redhat.com Reviewed-on: http://gerrit.ovirt.org/24202 Reviewed-by: Dan Kenigsberg danken@redhat.com --- M vdsm/vm.py 1 file changed, 18 insertions(+), 0 deletions(-)
Approvals: Federico Simoncelli: Verified Dan Kenigsberg: Looks good to me, approved
oVirt Jenkins CI Server has posted comments on this change.
Change subject: vm: discover volume path from xml definition ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7079/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7288/ : SUCCESS
vdsm-patches@lists.fedorahosted.org