Federico Simoncelli has posted comments on this change. Change subject: hsm: deleteImage fails because of wrong dictionary use ......................................................................
Patch Set 1: (2 comments) .................................................... File vdsm/storage/hsm.py Line 1525: # hence no need to create fake template if postZero is true. Line 1526: self._spmSchedule(spUUID, "zeroImage_%s" % imgUUID, dom.zeroImage, Line 1527: sdUUID, imgUUID, volsByImg) Line 1528: else: Line 1529: dom.deleteImage(sdUUID, imgUUID, volsByImg) > A fake volume is a small void volume, there is no real gain optimizing here. Check out what createFakeTemplate and its createVolume do. It looks to me like there's a lot to optimize out. Anyway you wouldn't have to check for FAKE_VOL every time, but only if needFake == True: if needFake == True and vol.getLegality() == volume.FAKE_VOL: self._spmSchedule(spUUID, "deleteImage_%s" % imgUUID, lambda: True) return # done Line 1530: # This is a hack to keep the interface consistent Line 1531: # We currently have race conditions in delete image, to quickly fix Line 1532: # this we delete images in the "synchronous" state. This only works Line 1533: # because Engine does not send two requests at a time. This hack is Line 1536: # an eliminate all race conditions Line 1537: if needFake: Line 1538: img = image.Image(os.path.join(self.storage_repository, Line 1539: spUUID)) Line 1540: tName = volsByImg.keys()[0] > Can't be more than one volume in a template image since ovirt images require > that the template image is composed by a unique volume. Yes, I stated that as first thing, """It works only because you have a dictionary with 1 key (but this is rather implicit)""" > For performance reasons we avoid to read MD multiple times and we want to > simplify the logic as far we can. The complexity is a product of the ovirt > images layout. Irrelevant here as the number of operations are the same. I'm in fact trying to simplify the logic here removing two unnecessary flags. Line 1541: tParams = dom.produceVolume(imgUUID, tName).getVolumeParams() Line 1542: img.createFakeTemplate(sdUUID=sdUUID, volParams=tParams) Line 1543: self._spmSchedule(spUUID, "deleteImage_%s" % imgUUID, lambda: True) Line 1544: -- To view, visit http://gerrit.ovirt.org/17383 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I81f9a5aa63c0914e3b934046454df64ccd39c269 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan <ykap...@redhat.com> Gerrit-Reviewer: Ayal Baron <aba...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Eduardo <ewars...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Yeela Kaplan <ykap...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches