Federico Simoncelli has posted comments on this change.
Change subject: image: copying a template is always allowed
......................................................................
Patch Set 2: (3 inline comments)
Why use moveImage(op="copy") for copying a template? Use
copyImage().
I'm not interested in moveImage (I'm just fixing it for consistency), I'm
interested in reusing your validations in syncImage.
....................................................
File vdsm/storage/hsm.py
Line 1298:
Line 1299: Copying an image based on a template to a data domain is allowed only
Line 1300: if the template already exists on the target domain.
Line 1301: """
Line 1302: dstAllVols = dstDom.getAllVolumes()
You need dstDom to get the sdUUID to maintain the error message at line 1302.
Line 1303:
Line 1304: for volName, volImages in self.__imageVolumes(srcAllVols, imgUUID):
Line 1305: if (len(volImages) > 1 and imgUUID != volImages[0]
Line 1306: and volName not in dstAllVols.keys()):
Line 1301: """
Line 1302: dstAllVols = dstDom.getAllVolumes()
Line 1303:
Line 1304: for volName, volImages in self.__imageVolumes(srcAllVols, imgUUID):
Line 1305: if (len(volImages) > 1 and imgUUID != volImages[0]
Done
Line 1306: and volName not in dstAllVols.keys()):
Line 1307: self.log.error("Cannot move image %s to domain %s because
"
Line 1308: "the template %s is missing on the
destination",
Line 1309: imgUUID, dstDom.sdUUID, volName)
Line 1339:
Line 1340: # Validates that the pool is connected. WHY?
Line 1341: pool = self.getPool(spUUID)
Line 1342:
Line 1343: if op != image.COPY_OP:
Given that op is not a boolean and it could contain any value (even future operations if
any), op != image.COPY_OP is stricter than op == image.MOVE_OP.
Line 1344: self.validateImageDelete(srcDom, srcAllVols, imgUUID)
Line 1345:
Line 1346: self.validateImageCopy(srcAllVols, dstDom, imgUUID)
Line 1347:
--
To view, visit
http://gerrit.ovirt.org/8408
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e07d569eec02ac4dcd386a7c576342f640ec242
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Shu Ming <shuming(a)linux.vnet.ibm.com>