

@atomic.action_timer('cinder.upload_volume_to_image')
def _upload_volume_to_image(self, volume, force=False, container_format='bare', disk_format='raw'):
    "Upload the given volume to image.\n\n        Returns created image.\n\n        :param volume: volume object\n        :param force: flag to indicate whether to snapshot a volume even if\n                      it's attached to an instance\n        :param container_format: container format of image. Acceptable\n                                 formats: ami, ari, aki, bare, and ovf\n        :param disk_format: disk format of image. Acceptable formats:\n                            ami, ari, aki, vhd, vmdk, raw, qcow2, vdi and iso\n        :returns: Returns created image object\n        "
    (resp, img) = volume.upload_to_image(force, self.generate_random_name(), container_format, disk_format)
    volume = bench_utils.wait_for(volume, ready_statuses=['available'], update_resource=bench_utils.get_from_manager(), timeout=CONF.benchmark.cinder_volume_create_timeout, check_interval=CONF.benchmark.cinder_volume_create_poll_interval)
    image_id = img['os-volume_upload_image']['image_id']
    image = self.clients('glance').images.get(image_id)
    image = bench_utils.wait_for(image, ready_statuses=['active'], update_resource=bench_utils.get_from_manager(), timeout=CONF.benchmark.glance_image_create_timeout, check_interval=CONF.benchmark.glance_image_create_poll_interval)
    return image

dataset/ETHPy150Open openstack/rally/rally/plugins/openstack/scenarios/cinder/utils.py CinderScenario._upload_volume_to_image/original