The nova.virt.disk.api Module

Utility methods to resize, repartition, and modify disk images.

Includes injection of SSH PGP keys into authorized_keys file.

bind(src, target, instance_name)

Bind device to a filesytem

can_resize_fs(image, size, use_cow=False)

Check whether we can resize contained file system.

destroy_container(container_dir)

Destroy the container once it terminates.

It will umount the container that is mounted, and delete any linked devices.

extend(image, size)

Increase image to size

get_disk_size(path)

Get the (virtual) size of a disk image

Parameters:path – Path to the disk image
Returns:Size (in bytes) of the given disk image as it would be seen by a virtual machine.
inject_data(image, key=None, net=None, metadata=None, admin_password=None, files=None, partition=None, use_cow=False)

Injects a ssh key and optionally net data into a disk image.

it will mount the image as a fully partitioned disk and attempt to inject into the specified partition number.

If partition is not specified it mounts the image as a single partition.

inject_data_into_fs(fs, key, net, metadata, admin_password, files)

Injects data into a filesystem already mounted by the caller. Virt connections can call this directly if they mount their fs in a different way to inject_data

mkfs(os_type, fs_label, target)
resize2fs(image, check_exit_code=False)
setup_container(image, container_dir, use_cow=False)

Setup the LXC container.

It will mount the loopback image to the container directory in order to create the root filesystem for the container.

unbind(target)

Previous topic

The nova.virt.connection Module

Next topic

The nova.virt.disk.guestfs Module

This Page