Skip to main content

docker-compose style composer for qemu

Project description

qemu-compose

qemu-compose aims to provide a docker-compose style composer for qemu command, with advanced scripting feature as well as http support for cloud init or general purpose provisioning.

Bring up a qemu VM by providing a qemu-compose.yml and run qemu-compose up

Advantages

  • Very simple and robust, written of several pure python scripts, depends on qemu commands only.
  • No libvirt stuff, no daemon process, no xml config, no complex abstraction, just a simple wrapper around qemu args.
  • support before_script and after_script for setup and cleanup
  • support boot_commands for vm provisioning (implemented using tty communication, gui not supported yet, and use jsonlisp for expressive power which apparently is turing-complete)
  • support http_serve for cloudinit
  • env interpolation for advanced configuration

Installation

$ pip install qemu-compose

Examples and Screenshot

bring up ubuntu cloudimg qemu vm and run a interactive shell

$ cd ./script/ubuntu-cloudimg__amd64/
$ qemu-compose up

Demo:

asciicast

SSH Helper

qemu-compose provides a helper to invoke ssh with the instance key and safe defaults.

  • Usage: qemu-compose ssh [OPTIONS] VMID COMMAND [ARG...]
  • Defaults added by qemu-compose:
    • -o StrictHostKeyChecking=no
    • -o UserKnownHostsFile=/dev/null
    • -i ~/.local/share/qemu-compose/instance/VMID/ssh-key
    • appends root@vsock%<cid> as the default destination (falls back to root@vsock%${cid} if CID is unknown)

Examples:

# Print the default ssh command that would be used for a given VMID
$ qemu-compose ssh <vmid>
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.local/share/qemu-compose/instance/<vmid>/ssh-key root@vsock%<cid>

# Connect using vsock destination (cid recorded when the VM booted)
$ qemu-compose ssh <vmid> root@vsock%<cid>

# Connect over TCP instead (override destination and add your own options)
$ qemu-compose ssh <vmid> -p 2222 root@127.0.0.1

# Run a remote command
$ qemu-compose ssh <vmid> root@vsock%<cid> uname -a

Notes:

  • The instance key is generated at first boot and stored under ~/.local/share/qemu-compose/instance/<vmid>/ssh-key.
  • Any ssh options you pass will be forwarded; the last-specified option wins.

Down Command

Stop and remove a VM instance.

$ qemu-compose down [identifier] [options]

Options:

  • identifier: Instance ID, unique prefix, or assigned name (optional if config file exists)
  • -f, --file FILE: Compose configuration file to parse for instance name
  • --force: Force removal without confirmation

Examples:

# Stop and remove instance by name
$ qemu-compose down my-vm

# Use config file to auto-detect instance name
$ cd ./script/ubuntu-cloudimg__amd64/
$ qemu-compose down

# Use specified config file
$ qemu-compose down -f /path/to/qemu-compose.yml

# Force removal
$ qemu-compose down --force my-vm

Note: If no identifier is provided, qemu-compose will look for qemu-compose.yml or qemu-compose.yaml in the current directory and use the name field as the instance identifier.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qemu_compose-0.9.0.tar.gz (105.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qemu_compose-0.9.0-py3-none-any.whl (129.4 kB view details)

Uploaded Python 3

File details

Details for the file qemu_compose-0.9.0.tar.gz.

File metadata

  • Download URL: qemu_compose-0.9.0.tar.gz
  • Upload date:
  • Size: 105.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qemu_compose-0.9.0.tar.gz
Algorithm Hash digest
SHA256 dba70d1a10b7d6501b874e2c0b1964aba869f4901ea0763948a1d975db4a417b
MD5 0034b8d83797be35e4a2e1b557c1ef96
BLAKE2b-256 89afacfdd2236d02a66a72564b4bb30e48d84f2db5bd0b9427183a472f8ef93a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qemu_compose-0.9.0.tar.gz:

Publisher: pypi.yml on zTrix/qemu-compose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qemu_compose-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: qemu_compose-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 129.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qemu_compose-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b6f1c09f5eb4084f19d013924eb61b710a7bbf522b9e5dc628c40189faec07b
MD5 41e02b751d7b4f521e3ab0efa7eac7f5
BLAKE2b-256 003c3fe89f22cee963c381f5053cbc6b2fb32e3792d82aee940d3bcf10683d44

See more details on using hashes here.

Provenance

The following attestation bundles were made for qemu_compose-0.9.0-py3-none-any.whl:

Publisher: pypi.yml on zTrix/qemu-compose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page