Skip to main content

Virtomate

Virtomate is a handy command-line application for managing virtual machines with libvirt. It runs on any Unix-like system with Python 3.10 and libvirt 9.0 (or newer) installed.

Accomplish complex tasks like cloning virtual machines with ease:

$ virtomate domain-clone --mode linked ubuntu-24.04 my-clone

Or run a command on the guest without SSH:

$ virtomate -p guest-run ubuntu-24.04 -- apt-get update
{
  "exit_code": 0,
  "signal": null,
  "stderr": null,
  "stderr_truncated": false,
  "stdout": "Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease\nHit:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease\nHit:3 http://archive.ubuntu.com/ubuntu noble-backports InRelease\nHit:4 http://security.ubuntu.com/ubuntu noble-security InRelease\nReading package lists...\n",
  "stdout_truncated": false
}

Virtomate's scripting-friendly interface makes automating administrative tasks a breeze. Pipe its JSON output to jq to extract the information you need and combine it with any other tool. Emptying a storage pool becomes a single line of code:

$ virtomate volume-list boot | jq '.[].name' | xargs -i virsh vol-delete {} --pool boot

Even if virtual machines are running on a remote host, don't let that stop you. Virtomate can connect to other hosts using remote URIs:

$ virtomate -c qemu+ssh://ubuntu@10.0.7.3/system -p domain-list
[
  {
    "name": "ubuntu-24.04",
    "state": "running",
    "uuid": "b901fbbb-1012-495d-a32d-90a8ddaa50a7"
  }
]

Learn more at https://virtomate.org/.

Installation

$ pipx install virtomate

For more installation options, see the Virtomate documentation.

Getting Help

If you need help, please start a discussion on GitHub.

Contributing

Please see the contribution guide.

Development

Prerequisites

To run the complete test suite, including the functional tests, you need a machine with an x86 CPU running Linux. Other operating systems like BSD or macOS might work but have not been tested.

Preparation

To run the complete test suite, including the functional tests, you have to build a couple of virtual machine images and configure libvirt accordingly. This is an optional step, and you can skip it if you do not want to run the functional tests.

Install libvirt, QEMU

Refer to the instructions of the respective Linux distribution:

Check that the command-line tools virsh and qemu-img are on PATH and working.

Create Storage Pools

The test suite expects the presence of the following storage pools:

  • default in /var/lib/libvirt/images
  • nvram in /var/lib/libvirt/qemu/nvram

If they do not exist, you can create them as follows:

$ virsh pool-define-as default dir --target /var/lib/libvirt/images
$ virsh pool-autostart default
$ virsh pool-build default
$ virsh pool-start default

$ virsh pool-define-as nvram dir --target /var/lib/libvirt/qemu/nvram
$ virsh pool-autostart nvram
$ virsh pool-build nvram
$ virsh pool-start nvram

Create Virtual Machine Images

The functional tests require some virtual machine images to run. There are Packer templates in packer/ to create them in a couple of minutes:

$ pushd packer
$ packer build simple-bios.pkr.hcl
$ packer build simple-uefi.pkr.hcl
$ popd

Packer will save the virtual machine images to packer/dist.

Then, import them into libvirt by running:

$ sudo ./prepare-pool.sh packer/dist

Create a Build

$ rye build

This will create a source distribution (.tar.gz) and a wheel (.whl) in the folder dist of the source root.

Run the Tests

To run the unit tests, run:

$ rye test

Run the Functional Tests

WARNING: Running the functional tests can cause data loss. The test suite will treat all virtual machines and storage volumes whose names start with virtomate- as test artefacts and delete them after each test.

To run the functional tests, activate the virtual environment with source .venv/bin/activate (on Unix-like operating systems) or . .\env\Scripts\activate.ps1 on Windows. Then run:

$ rye test -- --functional

Functional tests require a working libvirt installation with QEMU. See the section Preparation above.

By default, the functional tests connect to qemu:///system. If your local user cannot access qemu:///system, adding it to the group libvirt is usually sufficient.

To run the functional tests against a different libvirt instance, define the environment variable LIBVIRT_DEFAULT_URI accordingly. See the libvirt documentation on Connection URIs on how to do this.

License

Virtomate is licensed under the GNU General Public License, version 2 only.

Release files for virtomate 0.1.2

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

Source distribution (sdist)

Source distribution for virtomate 0.1.2
File Size Uploaded
virtomate-0.1.2.tar.gz 54.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for virtomate 0.1.2
File Interpreter ABI Platform
virtomate-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 83.5 kB

Release files / virtomate-0.1.2.tar.gz

Download URL virtomate-0.1.2.tar.gz
Size 54.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a1a04ccfd081d209afd9fb0dbe61ff64f60aa2b07f609fe4da22f84980a69361
BLAKE2b-256 checksum
How to use checksums
e2adb145f30da4c0305495450e24292c191fcaaed7e7424b8b8c74363d8a1efe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2025.

Transparency log

Release files / virtomate-0.1.2-py3-none-any.whl

Download URL virtomate-0.1.2-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9549f409895e299acde7ccb0e19e2a36ed060b7dcf8ee233f3f2b2b8fc7cf981
BLAKE2b-256 checksum
How to use checksums
7a0d6db54407daf58e12606c7ba3af6bf29e65411a54196428522625429547ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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