libvirt-provider


Namelibvirt-provider JSON
Version 0.0.1a4 PyPI version JSON
download
home_pagehttps://github.com/rasmunk/libvirt_provider
SummaryA corc plugin for a libvirt orchestration provider
upload_time2024-07-24 12:19:08
maintainerNone
docs_urlNone
authorRasmus Munk
requires_pythonNone
licenseMIT
keywords orchstration virtual machine
VCS
bugtrack_url
requirements libvirt-python jinja2 PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ================
libvirt_provider
================

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

A libvirt orchestration plugin for `corc <https://github.com/rasmunk/corc>`_

------------
Installation
------------

.. code-block:: bash

    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 <https://github.com/ucphhpc/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 <https://jinja.palletsprojects.com/en/3.1.x/>`_, `json <https://en.wikipedia.org/wiki/JSON>`_, 
or regular `python string formatting <https://docs.python.org/3/library/stdtypes.html#str.format>`_. 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>...

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rasmunk/libvirt_provider",
    "name": "libvirt-provider",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Orchstration, Virtual Machine",
    "author": "Rasmus Munk",
    "author_email": "munk1@live.dk",
    "download_url": "https://files.pythonhosted.org/packages/08/be/8fef8865be78a4cb273c49c939b916bea6522e87535820ba2342a31c94cb/libvirt_provider-0.0.1a4.tar.gz",
    "platform": null,
    "description": "================\nlibvirt_provider\n================\n\n.. image:: https://img.shields.io/pypi/pyversions/libvirt-provider.svg\n    :target: https://img.shields.io/pypi/pyversions/libvirt-provider\n.. image:: https://badge.fury.io/py/libvirt-provider.svg\n    :target: https://badge.fury.io/py/libvirt-provider\n\nA libvirt orchestration plugin for `corc <https://github.com/rasmunk/corc>`_\n\n------------\nInstallation\n------------\n\n.. code-block:: bash\n\n    pip install libvirt-provider\n\n------------\nDependencies\n------------\n\nBefore the ``libvirt-provider`` can be succesfully installed, the distribution associated dependency script\nin the ``devel_dep`` folder should be executed. This will install the nessesary library files that ``libvirt-provider``\nrequire to function properly.\n\nIn addition, before an actual resource such as an instance or a container can be created by ``libvirt-provider``,\nthe required ``libvirt`` daemon has to be running on the system. This can be installed via the distribution installer\nscripts in the ``runtime_dep`` folder.\n\n-----\nUsage\n-----\n\nThe libvirt-provider plugin can be used on its own to orchestrate libvirt resources.\nCurrently it supports orchestrating virtual machines and containers.\nThese resources can be orchestrated via the CLI interface::\n\n    $ libvirt-provider -h\n    usage: libvirt_provider [-h] {instance,container} ...\n\n    options:\n    -h, --help            show this help message and exit\n\n    COMMAND:\n    {instance,container}\n\nFor each of these resources, a certain set of actions can be performed.\nFor instance, to orchestrate an instance, the following command can be used::\n\n    $ usage: libvirt_provider instance create [-h]\n    [-dt INSTANCE_DOMAIN_TYPE] [-ddtype INSTANCE_DISK_DEVICE_TYPE] [-ddn INSTANCE_DISK_DRIVER_NAME]\n    [-ddt INSTANCE_DISK_DRIVER_TYPE] [-dtd INSTANCE_DISK_TARGET_DEV] [-dtb INSTANCE_DISK_TARGET_BUS]\n    [-memory INSTANCE_MEMORY_SIZE] [-vcpus INSTANCE_NUM_VCPUS] [-cpu-arch INSTANCE_CPU_ARCHITECTURE]\n    [-cpu-mode INSTANCE_CPU_MODE] [-mach INSTANCE_MACHINE] [-ct INSTANCE_CONSOLE_TYPE] [-st INSTANCE_SERIAL_TYPE]\n    [-sttp INSTANCE_SERIAL_TYPE_TARGET_PORT] [-tp INSTANCE_TEMPLATE_PATH]\n    name disk_image_path\n\n    optional arguments:\n    -h, --help            show this help message and exit\n\n    Instance create arguments:\n    name                  The name of the instance\n    disk_image_path       The path to the disk image\n    -dt INSTANCE_DOMAIN_TYPE, --domain-type INSTANCE_DOMAIN_TYPE\n                            The domain type\n    -ddtype INSTANCE_DISK_DEVICE_TYPE, --disk-device-type INSTANCE_DISK_DEVICE_TYPE\n                            The disk type\n    -ddn INSTANCE_DISK_DRIVER_NAME, --disk-driver-name INSTANCE_DISK_DRIVER_NAME\n                            The disk driver name\n    -ddt INSTANCE_DISK_DRIVER_TYPE, --disk-driver-type INSTANCE_DISK_DRIVER_TYPE\n                            The disk driver type\n    -dtd INSTANCE_DISK_TARGET_DEV, --disk-target-dev INSTANCE_DISK_TARGET_DEV\n                            The disk target device\n    -dtb INSTANCE_DISK_TARGET_BUS, --disk-target-bus INSTANCE_DISK_TARGET_BUS\n                            The disk target bus\n    -memory INSTANCE_MEMORY_SIZE, --memory-size INSTANCE_MEMORY_SIZE\n                            The memory size of the instance, interpreted as KiB. Default is 1024MiB.\n    -vcpus INSTANCE_NUM_VCPUS, --num-vcpus INSTANCE_NUM_VCPUS\n                            The number of virtual CPUs\n    -cpu-arch INSTANCE_CPU_ARCHITECTURE, --cpu-architecture INSTANCE_CPU_ARCHITECTURE\n                            The CPU architecture\n    -cpu-mode INSTANCE_CPU_MODE, --cpu-mode INSTANCE_CPU_MODE\n                            The CPU mode to be used when running the instance\n    -mach INSTANCE_MACHINE, --machine INSTANCE_MACHINE\n                            The machine type\n    -ct INSTANCE_CONSOLE_TYPE, --console-type INSTANCE_CONSOLE_TYPE\n                            The console type\n    -st INSTANCE_SERIAL_TYPE, --serial-type INSTANCE_SERIAL_TYPE\n                            The serial type\n    -sttp INSTANCE_SERIAL_TYPE_TARGET_PORT, --serial-type-target-port INSTANCE_SERIAL_TYPE_TARGET_PORT\n                            The serial type target port\n    -tp INSTANCE_TEMPLATE_PATH, --template-path INSTANCE_TEMPLATE_PATH\n                            The path to the XML template that should be used to create the instance.\n    -extra-tp-values KEY=VALUE [KEY=VALUE ...], --extra-template-path-values KEY=VALUE [KEY=VALUE ...]\n                            A set of key=value pair arguments that should be passed to the template. If a value contains spaces, you\n                            should define it with quotes.\n\nAs indicated by the instance creation command, the ``libvirt-provider`` expects that a disk image file is provided as an argument::\n\n    $ libvirt-provider instance create <name> <disk-image-file>\n\nThe <disk-image-file> can either be prepared by downloading directly from one of the distribution repositories, or a prepared with a tool\nlike our `libvirt-provider <https://github.com/ucphhpc/libvirt-provider>`_ before it is used to create an instance via ``libvirt-provider``.\n\n\nAfter the instance has been created, it can be started via the ``start`` argument::\n\n    $ libvirt-provider instance start <instance-id>\n\n\nIn turn, an orchestrated instance can be removed via the ``remove`` argument::\n\n    $ libvirt-provider instance remove <instance-id>\n\nTo discover the <instance-id> of a particular instance, the ``list`` argument can be used::\n\n    $ libvirt-provider instance ls\n    {\n        \"instances\": [],\n        \"msg\": \"Instances\",\n        \"status\": \"success\"\n    }\n\n----------\nTemplating\n----------\n\nThe ``libvirt-provider`` supports templating of the libvirt domain XML definition that is used to create a libvirt resource.\nThe supported XML template formats include `jinja <https://jinja.palletsprojects.com/en/3.1.x/>`_, `json <https://en.wikipedia.org/wiki/JSON>`_, \nor regular `python string formatting <https://docs.python.org/3/library/stdtypes.html#str.format>`_. Examples of such formats can be found in the\nrepostries examples directory.\n\nThe template file can be provided as an argument to the ``create`` command::\n\n    $ libvirt-provider instance create <name> <disk-image-file> -tp/--template-path <template-file> -extra-tp-values/--extra-template-path-values <key=value>...\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A corc plugin for a libvirt orchestration provider",
    "version": "0.0.1a4",
    "project_urls": {
        "Homepage": "https://github.com/rasmunk/libvirt_provider"
    },
    "split_keywords": [
        "orchstration",
        " virtual machine"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a698ebac6a15ca52372618c5629289ddfbc4ec4b4a99a8f6988b047d8d603b73",
                "md5": "6318a1fd893195eb3774da4156b9359f",
                "sha256": "9286cc2658aa7807518187bf96534c67e38b7085eb6f9cb0b4b70b2abae409aa"
            },
            "downloads": -1,
            "filename": "libvirt_provider-0.0.1a4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6318a1fd893195eb3774da4156b9359f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24289,
            "upload_time": "2024-07-24T12:19:07",
            "upload_time_iso_8601": "2024-07-24T12:19:07.376836Z",
            "url": "https://files.pythonhosted.org/packages/a6/98/ebac6a15ca52372618c5629289ddfbc4ec4b4a99a8f6988b047d8d603b73/libvirt_provider-0.0.1a4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08be8fef8865be78a4cb273c49c939b916bea6522e87535820ba2342a31c94cb",
                "md5": "0f5660b51753a2ec4e2ab43187ae3d06",
                "sha256": "b0cb4c37a42efa9a27bbb196ff4a8e73a19ada6488052f7865e4104912d4daf3"
            },
            "downloads": -1,
            "filename": "libvirt_provider-0.0.1a4.tar.gz",
            "has_sig": false,
            "md5_digest": "0f5660b51753a2ec4e2ab43187ae3d06",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18881,
            "upload_time": "2024-07-24T12:19:08",
            "upload_time_iso_8601": "2024-07-24T12:19:08.971770Z",
            "url": "https://files.pythonhosted.org/packages/08/be/8fef8865be78a4cb273c49c939b916bea6522e87535820ba2342a31c94cb/libvirt_provider-0.0.1a4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-24 12:19:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rasmunk",
    "github_project": "libvirt_provider",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "libvirt-python",
            "specs": [
                [
                    ">=",
                    "9.9.0"
                ]
            ]
        },
        {
            "name": "jinja2",
            "specs": [
                [
                    ">=",
                    "3.1.3"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "6.0.1"
                ]
            ]
        }
    ],
    "lcname": "libvirt-provider"
}
        
Elapsed time: 2.72053s