def test_image_info_error(): with pytest.raises(glance.ApiVersionError): glance.image_info(OVIRT_GLANCE_URL + "/fail") with pytest.raises(glance.ApiVersionError): glance.image_info(OVIRT_GLANCE_URL + "//v1") with pytest.raises(glance.ApiVersionError): glance.image_info(OVIRT_GLANCE_URL + "//v2")
def download(self, methodArgs, sdUUID, imgUUID, volUUID=None): domain = sdCache.produce(sdUUID) vol = self._activateVolumeForImportExport(domain, imgUUID, volUUID) try: self._check_sharing_method(methodArgs) # Extend the volume (if relevant) to the image size image_info = glance.image_info(methodArgs.get('url'), headers=methodArgs.get("headers")) vol.extend(image_info["size"]) glance.download_image(vol.getVolumePath(), methodArgs["url"], headers=methodArgs.get("headers")) finally: domain.deactivateImage(imgUUID)
def test_image_size(glance_image): info = glance.image_info(glance_image["url"]) assert info["size"] == glance_image["size"]