pycloudlib.qemu.cloud module
Cloud class for QEMU.
- class pycloudlib.qemu.cloud.Qemu(tag: str, timestamp_suffix: bool = True, config_file: Path | StringIO | None = None)[source]
Bases:
BaseCloudQEMU Cloud Class.
- __init__(tag: str, timestamp_suffix: bool = True, config_file: Path | StringIO | None = None)[source]
Initialize QemuCloud cloud class.
- Parameters:
tag – string used to name and tag resources with
timestamp_suffix – Append a timestamped suffix to the tag string.
config_file – path to pycloudlib configuration file
- clean() List[Exception][source]
Cleanup ALL artifacts associated with this Cloud instance.
This includes all instances, snapshots, resources, etc. To ensure cleanup isn’t interrupted, any exceptions raised during cleanup operations will be collected and returned.
- daily_image(release: str, **kwargs)[source]
ID of the latest daily image for a particular release.
Download the latest daily image unless it already exists.
- Parameters:
release – The release to look for
- Returns:
A single string with the latest daily image ID for the specified release.
- delete_image(image_id, **kwargs)[source]
Delete an image.
- Parameters:
image_id – string, id of the image to delete
**kwargs – dictionary of other arguments to pass to delete_image
- get_instance(instance_id, **kwargs) QemuInstance[source]
Get an instance by id.
- Parameters:
instance_id – The id for this instance. For QEMU this takes the form of <instance_path>::<ssh_port>::<telnet_port>
- Returns:
An instance object to use to manipulate the instance further.
- image_serial(image_id)[source]
Find the image serial of the latest daily image for a release.
- Parameters:
image_id – string, Ubuntu image id
- Returns:
string, serial of latest image
- launch(image_id: str, instance_type='c1m1500', user_data=None, meta_data=None, vendor_data=None, network_config=None, kernel_cmdline='', kernel_path=None, no_seed_iso=False, username: str | None = None, launch_args: List[str] | None = None, **kwargs) QemuInstance[source]
Launch an instance.
If user_data is passed, a seed iso will be created to be used as a NoCloud datasource. If user_data is not provided, a seed iso will not be created. User data can also be passed within the kernel_cmdline parameter.
- Parameters:
image_id – image ID to use for the instance. Can be either an absolute path to an image, or a path relative to the image_dir.
instance_type – Type of instance to create. For QEMU, this is in the form of c#m#, where # is the number of cpus and memory in MB.
user_data – used by cloud-init to run custom scripts/configuration
meta_data – used by cloud-init for custom metadata
vendor_data – used by cloud-init for custom vendor data
network_config – used by cloud-init for custom network data
kernel_cmdline – kernel command line arguments
kernel_path – path to kernel to use
no_seed_iso – if True, do not create a seed iso
username – username to use for ssh connection
launch_args – list of additional arguments to pass to qemu
- Returns:
An instance object to use to manipulate the instance further.
- list_keys()[source]
List ssh key names present on the cloud for accessing instances.
- Returns:
A list of strings of key pair names accessible to the cloud.
- released_image(release, **kwargs)[source]
ID of the latest released image for a particular release.
If an image for this series from any date has been downloaded, it will be used.
- Parameters:
release – The release to look for
- Returns:
A single string with the latest released image ID for the specified release.
- snapshot(instance: QemuInstance, clean=True, **kwargs) str[source]
Snapshot an instance and generate an image from it.
- Parameters:
instance – Instance to snapshot
clean – run instance clean method before taking snapshot
- Returns:
An image id