Skip to main content

libvirt_provider

https://img.shields.io/pypi/pyversions/libvirt-provider.svg https://badge.fury.io/py/libvirt-provider.svg

A libvirt orchestration plugin for corc

Installation

pip install libvirt-provider

Dependencies

Before the libvirt-provider can be succesfully installed, the distribution associated dependency script in the devel_dep folder should be executed. This will install the nessesary library files that libvirt-provider require to function properly.

In addition, before an actual resource such as an instance or a container can be created by libvirt-provider, the required libvirt daemon has to be running on the system. This can be installed via the distribution installer scripts in the runtime_dep folder.

Usage

The libvirt-provider plugin can be used on its own to orchestrate libvirt resources. Currently it supports orchestrating virtual machines and containers. These resources can be orchestrated via the CLI interface:

$ libvirt-provider -h
usage: libvirt_provider [-h] {instance,container} ...

options:
-h, --help            show this help message and exit

COMMAND:
{instance,container}

For each of these resources, a certain set of actions can be performed. For instance, to orchestrate an instance, the following command can be used:

$ usage: libvirt_provider instance create [-h]
[-dt INSTANCE_DOMAIN_TYPE] [-ddtype INSTANCE_DISK_DEVICE_TYPE] [-ddn INSTANCE_DISK_DRIVER_NAME]
[-ddt INSTANCE_DISK_DRIVER_TYPE] [-dtd INSTANCE_DISK_TARGET_DEV] [-dtb INSTANCE_DISK_TARGET_BUS]
[-memory INSTANCE_MEMORY_SIZE] [-vcpus INSTANCE_NUM_VCPUS] [-cpu-arch INSTANCE_CPU_ARCHITECTURE]
[-cpu-mode INSTANCE_CPU_MODE] [-mach INSTANCE_MACHINE] [-ct INSTANCE_CONSOLE_TYPE] [-st INSTANCE_SERIAL_TYPE]
[-sttp INSTANCE_SERIAL_TYPE_TARGET_PORT] [-tp INSTANCE_TEMPLATE_PATH]
name disk_image_path

optional arguments:
-h, --help            show this help message and exit

Instance create arguments:
name                  The name of the instance
disk_image_path       The path to the disk image
-dt INSTANCE_DOMAIN_TYPE, --domain-type INSTANCE_DOMAIN_TYPE
                        The domain type
-ddtype INSTANCE_DISK_DEVICE_TYPE, --disk-device-type INSTANCE_DISK_DEVICE_TYPE
                        The disk type
-ddn INSTANCE_DISK_DRIVER_NAME, --disk-driver-name INSTANCE_DISK_DRIVER_NAME
                        The disk driver name
-ddt INSTANCE_DISK_DRIVER_TYPE, --disk-driver-type INSTANCE_DISK_DRIVER_TYPE
                        The disk driver type
-dtd INSTANCE_DISK_TARGET_DEV, --disk-target-dev INSTANCE_DISK_TARGET_DEV
                        The disk target device
-dtb INSTANCE_DISK_TARGET_BUS, --disk-target-bus INSTANCE_DISK_TARGET_BUS
                        The disk target bus
-memory INSTANCE_MEMORY_SIZE, --memory-size INSTANCE_MEMORY_SIZE
                        The memory size of the instance, interpreted as KiB. Default is 1024MiB.
-vcpus INSTANCE_NUM_VCPUS, --num-vcpus INSTANCE_NUM_VCPUS
                        The number of virtual CPUs
-cpu-arch INSTANCE_CPU_ARCHITECTURE, --cpu-architecture INSTANCE_CPU_ARCHITECTURE
                        The CPU architecture
-cpu-mode INSTANCE_CPU_MODE, --cpu-mode INSTANCE_CPU_MODE
                        The CPU mode to be used when running the instance
-mach INSTANCE_MACHINE, --machine INSTANCE_MACHINE
                        The machine type
-ct INSTANCE_CONSOLE_TYPE, --console-type INSTANCE_CONSOLE_TYPE
                        The console type
-st INSTANCE_SERIAL_TYPE, --serial-type INSTANCE_SERIAL_TYPE
                        The serial type
-sttp INSTANCE_SERIAL_TYPE_TARGET_PORT, --serial-type-target-port INSTANCE_SERIAL_TYPE_TARGET_PORT
                        The serial type target port
-tp INSTANCE_TEMPLATE_PATH, --template-path INSTANCE_TEMPLATE_PATH
                        The path to the XML template that should be used to create the instance.
-extra-tp-values KEY=VALUE [KEY=VALUE ...], --extra-template-path-values KEY=VALUE [KEY=VALUE ...]
                        A set of key=value pair arguments that should be passed to the template. If a value contains spaces, you
                        should define it with quotes.

As indicated by the instance creation command, the libvirt-provider expects that a disk image file is provided as an argument:

$ libvirt-provider instance create <name> <disk-image-file>

The <disk-image-file> can either be prepared by downloading directly from one of the distribution repositories, or a prepared with a tool like our libvirt-provider before it is used to create an instance via libvirt-provider.

After the instance has been created, it can be started via the start argument:

$ libvirt-provider instance start <instance-id>

In turn, an orchestrated instance can be removed via the remove argument:

$ libvirt-provider instance remove <instance-id>

To discover the <instance-id> of a particular instance, the list argument can be used:

$ libvirt-provider instance ls
{
    "instances": [],
    "msg": "Instances",
    "status": "success"
}

Templating

The libvirt-provider supports templating of the libvirt domain XML definition that is used to create a libvirt resource. The supported XML template formats include jinja, json, or regular python string formatting. Examples of such formats can be found in the repostries examples directory.

The template file can be provided as an argument to the create command:

$ libvirt-provider instance create <name> <disk-image-file> -tp/--template-path <template-file> -extra-tp-values/--extra-template-path-values <key=value>...

Metadata

Release files for libvirt-provider 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libvirt-provider 0.0.6
File Size Uploaded Provenance
libvirt_provider-0.0.6.tar.gz 36.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for libvirt-provider 0.0.6
File Interpreter ABI Platform
libvirt_provider-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 104.0 kB

Release files / libvirt_provider-0.0.6.tar.gz

Download URL libvirt_provider-0.0.6.tar.gz
Size 36.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b8c91ad8f44e47be95a285199d41f0b89da9f36b3d1fe0bad1a1f44fdcae2eaa
BLAKE2b-256 checksum
How to use checksums
dae9968d37dd24c3b03499e834017b45c665824f6d1c4f76b7c999eb22eb7735
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / libvirt_provider-0.0.6-py3-none-any.whl

Download URL libvirt_provider-0.0.6-py3-none-any.whl
Size 68.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d485fb4c077d09634fc9d7cf0b995df977e706050f466d122574b8256bc1c1
BLAKE2b-256 checksum
How to use checksums
76f4fec1b9605a3202b82fc77166d00aabd021b73c598eba321afb18f4a6143e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Security for libvirt-provider 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page