Nir Soffer has posted comments on this change. Change subject: hsm: add uploaded image verification ......................................................................
Patch Set 2: (4 comments) Mostly fine, but I'm not sure about the name. This is not about an upload, but about verifying an image after a user that was exposed for writing via imageio-daemon, or maybe by other means. For example, we may like to use the same verification after downloading image from another machine directly into an image, or after importing image from external system. Actually any time when we write qcow image that we did not generate. https://gerrit.ovirt.org/#/c/55746/2/vdsm/storage/hsm.py File vdsm/storage/hsm.py: Line 1554: @public Line 1555: def verifyUpload(self, sdUUID, spUUID, imgUUID, volUUID): Line 1556: dom = sdCache.produce(sdUUID=sdUUID) Line 1557: vol = dom.produceVolume(imgUUID, volUUID) Line 1558: vol_qemu_info = qemuimg.info(vol.getVolumePath()) Let call this actual_info Line 1559: Line 1560: vol_md_fmt = volume.FMT2STR[vol.getFormat()] Line 1561: uploaded_fmt = vol_qemu_info["format"] Line 1562: if vol_md_fmt != uploaded_fmt: Line 1556: dom = sdCache.produce(sdUUID=sdUUID) Line 1557: vol = dom.produceVolume(imgUUID, volUUID) Line 1558: vol_qemu_info = qemuimg.info(vol.getVolumePath()) Line 1559: Line 1560: vol_md_fmt = volume.FMT2STR[vol.getFormat()] Lets call this expected_format Line 1561: uploaded_fmt = vol_qemu_info["format"] Line 1562: if vol_md_fmt != uploaded_fmt: Line 1563: raise se.ImageVerificationError( Line 1564: "Uploaded image format is %s while the format specified " Line 1557: vol = dom.produceVolume(imgUUID, volUUID) Line 1558: vol_qemu_info = qemuimg.info(vol.getVolumePath()) Line 1559: Line 1560: vol_md_fmt = volume.FMT2STR[vol.getFormat()] Line 1561: uploaded_fmt = vol_qemu_info["format"] And actual_format Line 1562: if vol_md_fmt != uploaded_fmt: Line 1563: raise se.ImageVerificationError( Line 1564: "Uploaded image format is %s while the format specified " Line 1565: "by the user is %s" % (uploaded_fmt, vol_md_fmt) Line 1562: if vol_md_fmt != uploaded_fmt: Line 1563: raise se.ImageVerificationError( Line 1564: "Uploaded image format is %s while the format specified " Line 1565: "by the user is %s" % (uploaded_fmt, vol_md_fmt) Line 1566: ) We don't use this style, look how other logs are formatted in this file. Line 1567: if "backingfile" in vol_qemu_info: Line 1568: raise se.ImageVerificationError( Line 1569: "'%s' is defined as a backingfile, while backingfile is not " Line 1570: "allowed for an uploaded image." -- To view, visit https://gerrit.ovirt.org/55746 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibf85061536eb4ddff021539c742a674f183a8984 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Amit Aviram <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Ala Hino <[email protected]> Gerrit-Reviewer: Amit Aviram <[email protected]> Gerrit-Reviewer: Freddy Rolland <[email protected]> Gerrit-Reviewer: Greg Padgett <[email protected]> Gerrit-Reviewer: Idan Shaby <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Liron Aravot <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: gerrit-hooks <[email protected]> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
