Helper methods to deal with images.
This is essentially a copy from nova.virt.images.py Some slight modifications, but at some point we should look at maybe pushing this up to Oslo
TemporaryImages
(image_service)¶Bases: object
Manage temporarily downloaded images to avoid downloading it twice.
In the ‘with TemporaryImages.fetch(image_service, ctx, image_id) as tmp’ clause, ‘tmp’ can be used as the downloaded image path. In addition, image_utils.fetch() will use the pre-fetched image by the TemporaryImages. This is useful to inspect image contents before conversion.
fetch
(**kwds)¶for_image_service
(image_service)¶get
(context, image_id)¶check_available_space
(dest, image_size, image_id)¶check_qemu_img_version
(minimum_version)¶check_virtual_size
(virtual_size, volume_size, image_id)¶cleanup_temporary_file
(backend_name)¶coalesce_chain
(vhd_chain)¶coalesce_vhd
(vhd_path)¶convert_image
(source, dest, out_format, out_subformat=None, src_format=None, run_as_root=True, throttle=None, cipher_spec=None, passphrase_file=None)¶create_temporary_file
(*args, **kwargs)¶decode_cipher
(cipher_spec, key_size)¶Decode a dm-crypt style cipher specification string
The assumed format being cipher[:keycount]-chainmode-ivmode[:ivopts] as documented under linux/Documentation/device-mapper/dm-crypt.txt in the kernel source tree.
discover_vhd_chain
(directory)¶extract_targz
(archive_name, target)¶fetch
(context, image_service, image_id, path, _user_id, _project_id)¶fetch_to_raw
(context, image_service, image_id, dest, blocksize, user_id=None, project_id=None, size=None, run_as_root=True)¶fetch_to_vhd
(context, image_service, image_id, dest, blocksize, volume_subformat=None, user_id=None, project_id=None, run_as_root=True)¶fetch_to_volume_format
(context, image_service, image_id, dest, volume_format, blocksize, volume_subformat=None, user_id=None, project_id=None, size=None, run_as_root=True)¶fetch_verify_image
(context, image_service, image_id, dest, user_id=None, project_id=None, size=None, run_as_root=True)¶fix_vhd_chain
(vhd_chain)¶fixup_disk_format
(disk_format)¶Return the format to be provided to qemu-img convert.
from_qemu_img_disk_format
(disk_format)¶Return the conventional format derived from qemu-img format.
get_qemu_data
(image_id, has_meta, disk_format_raw, dest, run_as_root, force_share=False)¶get_qemu_img_version
()¶The qemu-img version will be cached until the process is restarted.
get_vhd_size
(vhd_path)¶is_xenserver_format
(image_meta)¶qemu_img_info
(path, run_as_root=True, force_share=False)¶Return an object containing the parsed output from qemu-img info.
replace_xenserver_image_with_coalesced_vhd
(image_file)¶resize_image
(source, size, run_as_root=False)¶Changes the virtual size of the image.
resize_vhd
(vhd_path, size, journal)¶set_vhd_parent
(vhd_path, parentpath)¶temporary_dir
()¶temporary_file
(*args, **kwds)¶upload_volume
(context, image_service, image_meta, volume_path, volume_format='raw', run_as_root=True)¶verify_glance_image_signature
(context, image_service, image_id, path)¶Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.