Utility methods to resize, repartition, and modify disk images.
Includes injection of SSH PGP keys into authorized_keys file.
Check whether we can resize contained file system.
Clean up the container namespace rootfs mounting one spawned.
It will umount the mounted names that is mounted but leave the linked deivces alone.
Increase image to size.
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 the specified items into a disk image.
If an item name is not specified in the MANDATORY iterable, then a warning is logged on failure to inject that item, rather than raising an exception.
it will mount the image as a fully partitioned disk and attempt to inject into the specified partition number.
If PARTITION is not specified the image is mounted as a single partition.
Returns True if all requested operations completed without issue. Raises an exception if a mandatory item can’t be injected.
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.
If an item name is not specified in the MANDATORY iterable, then a warning is logged on failure to inject that item, rather than raising an exception.
Returns True if all requested operations completed without issue. Raises an exception if a mandatory item can’t be injected.
Setup the LXC container.
It will mount the loopback image to the container directory in order to create the root filesystem for the container.
Teardown the container rootfs mounting once it is spawned.
It will umount the container that is mounted, and delete any linked devices.