Change in vdsm[master]: hsm: add uploaded image verification

aaviram at redhat.com aaviram at redhat.com
Thu Apr 7 07:10:35 UTC 2016


Amit Aviram has posted comments on this change.

Change subject: hsm: add uploaded image verification
......................................................................


Patch Set 2:

(9 comments)

https://gerrit.ovirt.org/#/c/55746/2/lib/api/vdsmapi-schema.json
File lib/api/vdsmapi-schema.json:

Line 8504:           'postZero': 'bool', 'force': 'bool'},
Line 8505:  'returns': 'UUID'}
Line 8506: 
Line 8507: ##
Line 8508: # @Volume.verify_upload:
> How about verify_untrusted_volume?
As this is a Volume's method, we can call it verify_untrusted (Finally it will be @Volume.verify_untrusted)
Line 8509: #
Line 8510: # Verify an uploaded image's volume. The verification includes comparing
Line 8511: # the uploaded image's format with the format that is specified in the
Line 8512: # image's volume's metadata, and if the format is QCOW, verifying that


Line 8506: 
Line 8507: ##
Line 8508: # @Volume.verify_upload:
Line 8509: #
Line 8510: # Verify an uploaded image's volume. The verification includes comparing
> Upload is only one use case.
Done, will generalize.
Line 8511: # the uploaded image's format with the format that is specified in the
Line 8512: # image's volume's metadata, and if the format is QCOW, verifying that
Line 8513: # it has no backingfile. if one of the verifications above fails, an
Line 8514: # error will be raised.


Line 8512: # image's volume's metadata, and if the format is QCOW, verifying that
Line 8513: # it has no backingfile. if one of the verifications above fails, an
Line 8514: # error will be raised.
Line 8515: #
Line 8516: # @volumeID:         The UUID of the Volume
> The volume id typically appear last (PDIV - pool, domain, image, volume). T
Done
Line 8517: #
Line 8518: # @storagepoolID:    The Storage Pool associated with the Volume
Line 8519: #
Line 8520: # @storagedomainID:  The Storage Domain associated with the Volume


https://gerrit.ovirt.org/#/c/55746/2/vdsm/API.py
File vdsm/API.py:

Line 826:         return self._irs.deleteVolume(self._sdUUID, self._spUUID,
Line 827:                                       self._imgUUID, [self._UUID], postZero,
Line 828:                                       force)
Line 829: 
Line 830:     def verify_upload(self):
> Lets keep the new style (verify_upload) all the way down, or the old style,
Done
Line 831:         return self._irs.verifyUpload(self._sdUUID, self._spUUID,
Line 832:                                       self._imgUUID, self._UUID)
Line 833: 
Line 834:     def extendSize(self, newSize):


Line 828:                                       force)
Line 829: 
Line 830:     def verify_upload(self):
Line 831:         return self._irs.verifyUpload(self._sdUUID, self._spUUID,
Line 832:                                       self._imgUUID, self._UUID)
> Keep the argument in the same order both in the schema and here (PDIV).
Done
Line 833: 
Line 834:     def extendSize(self, newSize):
Line 835:         return self._irs.extendVolumeSize(
Line 836:             self._spUUID, self._sdUUID, self._imgUUID, self._UUID, newSize)


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
Done
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
Done
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
Done
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.
I'm not sure what do you mean, I see in this file:
"""
raise se.VolumeGroupSizeError(
                "VG size must be more than %s MiB" %
                str(MINIMALVGSIZE / constants.MEGAB))
"""
"""
raise se.StoragePoolConnected(
                "hostId=%s, newHostId=%s" % (pool.id, hostId))
"""
"""
raise se.CannotDeleteSharedVolume("Cannot delete shared "
                                                      "image %s. volImgs: %s" %
                                                      (imgUUID, volsByImg))
"""

What is the difference between those and this error message?
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 <aaviram at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Ala Hino <ahino at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Greg Padgett <gpadgett at redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list