delonix vm

microVMs declarativas: create, ls, status, stop, rm, apply.

Declarative microVMs: create, ls, status, stop, rm, apply.

MicroVMs geridas pelo trait VmBackend — Cloud Hypervisor ou libvirt. O create é idempotente (cria ou auto-recupera) e suporta cloud-init por instância: --hostname, --ssh-key e --user-data geram um ISO NoCloud automaticamente. É a camada que o delonix cluster kubeadm usa para provisionar nós.

MicroVMs managed by the VmBackend trait — Cloud Hypervisor or libvirt. create is idempotent (creates or self-heals) and supports per-instance cloud-init: --hostname, --ssh-key and --user-data generate a NoCloud ISO automatically. It's the layer delonix cluster kubeadm uses to provision nodes.

Usage: dlx vm [OPTIONS] <COMMAND>

Commands:
  dash       Dashboard (KPIs + table) of the VMs — interactive TUI, or `--once` snapshot
  init       Bootstrap a project with a VM manifest — files ALREADY FILLED IN (images included), ready to use without editing anything
  create     Create (or auto-recover) a VM
  build      Build a qcow2 VM image from a `VMfile`
  pull       Pull a golden VM image from an OCI registry — with no argument, the OFFICIAL Delonix image (ready for `vm create`/`cluster kubeadm`)
  ls-remote  List the tags available in a remote OCI repository — with no argument, the OFFICIAL Delonix golden image repo (discover which k8s versions are published before `pull`)
  push       Push a local golden VM image to an OCI registry (`vm push <name> <target>`)
  ls         List the VMs
  console    Attach to the VM's serial console (interactive terminal) — works with no IP (boot logs, login). Escape: Ctrl-] 
  vnc        Print the VNC address of a graphical VM (created with `--vnc`, libvirt)
  status     Current state (reconciles liveness/IP with the backend)
  reach      
  bridge     EXPERIMENTAL (root): give a libvirt VM DIRECT IP reachability to a container SDN network (veth from the host into the holder netns + routes). Defaults to a DRY-RUN; add `--apply` (as root) to establish it
  unbridge   Tear down a `vm bridge` (dry-run without `--apply`)
  describe   Human-readable detail of one or more VMs, `kubectl describe` style (for humans; use `status` for the usual compact view). Includes the LIVE state — `delonix_vm::status` reconciles liveness/IP with the backend
  stop       Stop the VM (preserves disk/record)
  start      Start an existing, stopped VM — idempotent (already running = no-op). Reboots with the base disk/vcpus/memory/network/backend recorded at its last `create`/`start`, reusing the same overlay (disk state preserved). Does NOT restore anything that only ever existed as a `vm create` flag (custom kernel/seed/volumes/static IP/VNC/advanced libvirt knobs) — a VM using those needs the original `vm create` invocation instead (also idempotent/auto-heal)
  restart    Stop (if running) then start — always a real reboot, unlike `start`. Same recovered-fields limits as `start`
  rm         Remove the VM (stops + deletes overlay/state)
  snapshot   Take a named snapshot (libvirt: a running VM's snapshot is a system checkpoint — memory + disk; `restore` reverts to it). Not yet supported on the cloud-hypervisor backend
  restore    Revert the VM to a named snapshot
  snapshots  List the VM's snapshots
  apply      Apply the `kind: Vm` documents of a manifest (`delonix_vm::create` is already idempotent by name — creates or auto-recovers)
  help       Print this message or the help of the given subcommand(s)

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

vm snapshots

List the VM's snapshots

Usage: dlx vm snapshots [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Listar os checkpoints de uma VM
delonix vm snapshots dev

vm restore

Revert the VM to a named snapshot

Usage: dlx vm restore [OPTIONS] <NAME> <SNAPSHOT>

Arguments:
  <NAME>      
  <SNAPSHOT>  Snapshot name to revert to

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Voltar ao checkpoint
delonix vm restore dev antes-do-upgrade

vm snapshot

Take a named snapshot (libvirt: a running VM's snapshot is a system checkpoint — memory + disk; restore reverts to it). Not yet supported on the cloud-hypervisor backend

Usage: dlx vm snapshot [OPTIONS] <NAME> <SNAPSHOT>

Arguments:
  <NAME>      
  <SNAPSHOT>  Snapshot name

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Checkpoint de sistema (memória + disco) de uma VM A CORRER
delonix vm snapshot dev antes-do-upgrade

vm restart

Stop (if running) then start — always a real reboot, unlike start. Same recovered-fields limits as start

Usage: dlx vm restart [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Reinício forçado (pára e volta a arrancar)
delonix vm restart dev

vm start

Start an existing, stopped VM — idempotent (already running = no-op). Reboots with the base disk/vcpus/memory/network/backend recorded at its last create/start, reusing the same overlay (disk state preserved). Does NOT restore anything that only ever existed as a vm create flag (custom kernel/seed/volumes/static IP/VNC/advanced libvirt knobs) — a VM using those needs the original vm create invocation instead (also idempotent/auto-heal)

Usage: dlx vm start [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Voltar a arrancar uma VM parada, sem repetir as flags do create
delonix vm start dev

vm describe

Human-readable detail of one or more VMs, kubectl describe style (for humans; use status for the usual compact view). Includes the LIVE state — delonix_vm::status reconciles liveness/IP with the backend

Usage: dlx vm describe [OPTIONS] <NAMES>...

Arguments:
  <NAMES>...  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Tudo sobre uma VM, estilo kubectl describe
delonix vm describe dev

vm unbridge

Tear down a vm bridge (dry-run without --apply)

Usage: dlx vm unbridge [OPTIONS] <NETWORK>

Arguments:
  <NETWORK>  

Options:
      --apply         
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Fechar a ponte VM↔container
sudo delonix vm unbridge minha-rede

vm bridge

EXPERIMENTAL (root): give a libvirt VM DIRECT IP reachability to a container SDN network (veth from the host into the holder netns + routes). Defaults to a DRY-RUN; add --apply (as root) to establish it

Usage: dlx vm bridge [OPTIONS] <NETWORK>

Arguments:
  <NETWORK>  

Options:
      --l18n <en|pt>           Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
      --vm-subnet <VM_SUBNET>  VM subnet(s) to route back (default: auto-detected `virbr*`). Repeatable
      --apply                  Actually run the privileged plan (requires root). Without it: dry-run
  -h, --help                   Print help

Exemplos

Ver o plano SEM aplicar (o default é dry-run)
delonix vm bridge minha-rede
Aplicar mesmo — precisa de root, é a excepção deliberada ao rootless
sudo delonix vm bridge minha-rede --apply

vm reach

Usage: dlx vm reach [OPTIONS]

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Que portas de container é que as VMs conseguem alcançar
delonix vm reach

vm vnc

Print the VNC address of a graphical VM (created with --vnc, libvirt)

Usage: dlx vm vnc [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Abrir o ecrã gráfico da VM
delonix vm vnc dev

vm console

Attach to the VM's serial console (interactive terminal) — works with no IP (boot logs, login). Escape: Ctrl-]

Usage: dlx vm console [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Consola série (voltar ao host: Ctrl+])
delonix vm console dev

vm push

Push a local golden VM image to an OCI registry (vm push <name> <target>)

Usage: dlx vm push [OPTIONS] <NAME> <TARGET>

Arguments:
  <NAME>    
  <TARGET>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Publicar a tua imagem como artefacto OCI
printf '%s' "$GHCR_TOKEN" | delonix image login ghcr.io --username aminhaorg
delonix vm push minha-base:1.0 ghcr.io/aminhaorg/minha-base:1.0

vm ls-remote

List the tags available in a remote OCI repository — with no argument, the OFFICIAL Delonix golden image repo (discover which k8s versions are published before pull)

Usage: dlx vm ls-remote [OPTIONS] [SOURCE]

Arguments:
  [SOURCE]  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
      --no-k8s        With no `source`, list the official NO-Kubernetes golden's repo instead of the Kubernetes one
  -h, --help          Print help

Exemplos

Que versões existem publicadas, antes de puxar
delonix vm ls-remote
As tags de um repositório teu
delonix vm ls-remote ghcr.io/aminhaorg/base

vm pull

Pull a golden VM image from an OCI registry — with no argument, the OFFICIAL Delonix image (ready for vm create/cluster kubeadm)

Usage: dlx vm pull [OPTIONS] [SOURCE]

Arguments:
  [SOURCE]  OCI reference (default: the official Delonix image)

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
      --name <NAME>   Local name (default: derived from the reference)
      --no-k8s        With no `source`, pull the official NO-Kubernetes golden (just the `delonix` engine, rootless-ready) instead of the Kubernetes one
  -h, --help          Print help

Exemplos

A golden oficial com Kubernetes (sem argumento)
delonix vm pull
A golden SEM Kubernetes — só o motor, pronta a rootless
delonix vm pull --no-k8s
De um registo teu, com nome local próprio
delonix vm pull ghcr.io/aminhaorg/base:24.04 --name base:24.04

vm build

Build a qcow2 VM image from a VMfile

Usage: dlx vm build [OPTIONS] --tag <TAG> [CONTEXT]

Arguments:
  [CONTEXT]  Build context — the directory `COPY` reads from [default: .]

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -t, --tag <TAG>     
  -f, --file <FILE>   The `VMfile` (default: `<context>/VMfile`)
      --no-compress   Do not compress the final qcow2
      --network       Give the guest network access during `RUN` (for `apt-get install` and friends). Off by default: a build that reaches the internet produces a different image depending on when it ran
  -h, --help          Print help

Exemplos

Construir a partir do VMfile do directório actual
delonix vm build -t minha-base:1.0 .
VMfile noutro caminho, sem compressão (build mais rápido, imagem maior)
delonix vm build -t minha-base:dev -f receitas/VMfile --no-compress .
Com rede no convidado — precisa disto para `apt-get install` num RUN (o build deixa de ser reproduzível: o resultado passa a depender do dia)
delonix vm build --network -t minha-base:1.0 .

vm init

Bootstrap a project with a VM manifest — files ALREADY FILLED IN (images included), ready to use without editing anything

Usage: dlx vm init [OPTIONS] [DIR]

Arguments:
  [DIR]  Project directory (default: the current one) [default: .]

Options:
      --l18n <en|pt>         Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
      --name <NAME>          Project name (default: the directory name)
      --image <IMAGE>        Image to use. Omit = fills in with the default image
      --force                Overwrite existing files
      --vmfile               Scaffold a `VMfile` for BUILDING your own qcow2 image, instead of a manifest for RUNNING an existing one. The two are different jobs and this is the same verb for both: `init` starts a project either way
  -t, --template <TEMPLATE>  Generate a complete PROJECT for a stack (e.g. `python`) with best practices, instead of the generic scaffold. `--template list` shows the available ones
      --up                   After generating, build the image, start it, and wait until healthy
  -h, --help                 Print help

Exemplos

Projecto com manifesto, pronto a correr
delonix vm init --name lab
Scaffold de um VMfile para CONSTRUIR a tua imagem
delonix vm init --vmfile --name minha-base

vm dash

Dashboard (KPIs + table) of the VMs — interactive TUI, or --once snapshot

Usage: dlx vm dash [OPTIONS]

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
      --once          
      --json          
  -h, --help          Print help

Exemplos

Dashboard só das VMs (htop-style; `q` sai)
delonix vm dash
Snapshot para um script ou para o Grafana
delonix vm dash --json | jq '.tiles'

vm create

Create (or auto-recover) a VM

Usage: dlx vm create [OPTIONS] <NAME>

Arguments:
  <NAME>
          

Options:
      --l18n <en|pt>
          Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand

      --url-img <URL_IMG>
          Absolute URL of a qcow2 cloud image to boot this VM from.
          
          Downloaded once and cached, so a second `create` from the same URL costs nothing. Verified against a sibling `<url>.sha256` when the publisher offers one; without it, the download is trusted on TLS alone and SAYS SO — someone pointing this at their own bucket deserves to know which of the two they got.

      --disk <DISK>
          Base disk (qcow2/raw) — becomes a per-VM overlay. Omit to use the local golden VM image (if there is exactly one; `image --vm ls`)

      --vcpus <VCPUS>
          [default: 1]

      --memory <MEMORY>
          Memory (`"2G"`/`"1024M"`)
          
          [default: 1G]

      --network <NETWORK>
          Ingress network for the tap (default: the system ingress network; a custom network must be created first with `delonix network create`)
          
          [default: ingress]

      --namespace <NAMESPACE>
          Isolation namespace (default `default`): VMs of different namespaces do not reach each other. Requires `--backend cloud-hypervisor`

      --kernel <KERNEL>
          Kernel for direct boot

      --initrd <INITRD>
          

      --firmware <FIRMWARE>
          Firmware, alternative to the kernel (cloud images)

      --cmdline <CMDLINE>
          

      --seed <SEED>
          Ready-made cloud-init (NoCloud) ISO — if given, takes priority over `--hostname`/`--ssh-key`/`--user-data` (those generate the ISO; this uses it directly)

      --hostname <HOSTNAME>
          Hostname to apply on first boot (generates the NoCloud ISO if no explicit `--seed` is given)

      --ssh-key <SSH_KEYS>
          Authorized public SSH key, `ssh-ed25519 AAAA...` or `@path` to read from a file. Repeatable

      --user-data <USER_DATA>
          Your own cloud-init `user-data` (fully replaces the default-generated one) — full control for whoever needs it

      --restart-policy <RESTART_POLICY>
          `no`|`on-failure`|`always`

      --hugepages
          

      --cpu-affinity <CPU_AFFINITY>
          Core affinity, e.g. `8-15`

      --device <DEVICES>
          VFIO PCI passthrough, repeatable

      --backend <BACKEND>
          `cloud-hypervisor`|`libvirt` (omit = auto-detection)

      --net-mode <NET_MODE>
          libvirt only: `user`|`nat`|`bridge`

      --bridge <BRIDGE>
          Bridge name (net-mode=bridge) or libvirt network (nat)

      --ip <IP>
          Static IP (libvirt nat mode): DHCP reservation on the libvirt network

      --vnc
          VNC graphical console (libvirt backend only — Cloud Hypervisor has no display)

      --console
          After starting, attach to the serial console to watch the boot live (Ctrl-] to detach)

      --wait
          After starting, wait (with a spinner) until the VM has an IP, up to --boot-timeout

      --boot-timeout <BOOT_TIMEOUT>
          Seconds to wait with --wait (default 120)
          
          [default: 120]

  -h, --help
          Print help (see a summary with '-h')

Exemplos

VM a partir da imagem dourada, com chave SSH
delonix vm create --name node1 --image k8s-golden --cpus 2 --memory 4096 --ssh-key @~/.ssh/id_ed25519.pub

vm ls

List the VMs

Usage: dlx vm ls [OPTIONS]

Options:
      --l18n <en|pt>     Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
      --ports            Also probe a short list of well-known ports (22, 6443, 10250, 80, 443) on each VM's IP and show which respond — a real TCP connect per port, short timeout, run concurrently. Off by default: unlike the rest of `ls` (local state only), this does live network I/O and can add latency, especially for an unreachable/booting VM
  -o, --output <OUTPUT>  Output format: `table` (default) or `json` (ADR-0005). The `ports_open` field is included only with `--ports` (same as the table column — the probe does live network I/O, off by default) [default: table] [possible values: table, json]
  -h, --help             Print help

Exemplos

delonix vm ls

vm status

Current state (reconciles liveness/IP with the backend)

Usage: dlx vm status [OPTIONS] [NAME]

Arguments:
  [NAME]  VM to query (omit for the state of ALL)

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

Reconcilia liveness/IP com o backend
delonix vm status node1

vm stop

Stop the VM (preserves disk/record)

Usage: dlx vm stop [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

delonix vm stop node1

vm rm

Remove the VM (stops + deletes overlay/state)

Usage: dlx vm rm [OPTIONS] <NAME>

Arguments:
  <NAME>  

Options:
  -f, --force         Remove the local state even if the libvirt cleanup fails
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

delonix vm rm node1

vm apply

Apply the kind: Vm documents of a manifest (delonix_vm::create is already idempotent by name — creates or auto-recovers)

Usage: dlx vm apply [OPTIONS]

Options:
  -f, --file <FILE>   
      --l18n <en|pt>  Output language: `en` (default) or `pt` (Portuguese, pt_AO). Also settable via `$DELONIX_L18N`. Global — works before any subcommand
  -h, --help          Print help

Exemplos

delonix vm apply -f delonix-manifest.yaml

LaboratórioLab

Cria uma microVM com cloud-init automático e liga-te por SSH.

delonix vm create dev --hostname dev --ssh-key ~/.ssh/id_ed25519.pub
delonix vm status dev
ssh delonix@$(delonix vm status dev --ip)

Create a microVM with automatic cloud-init and SSH into it.

delonix vm create dev --hostname dev --ssh-key ~/.ssh/id_ed25519.pub
delonix vm status dev
ssh delonix@$(delonix vm status dev --ip)

DesafioChallenge

Só no backend libvirt: tira um snapshot da VM a correr, muda alguma coisa lá dentro, e usa restore para voltar atrás. Confirma que a mudança desapareceu.

delonix vm snapshot dev antes-da-mudanca
delonix vm restore dev antes-da-mudanca

libvirt backend only: take a snapshot of the running VM, change something inside it, then use restore to roll back. Confirm the change is gone.

delonix vm snapshot dev before-the-change
delonix vm restore dev before-the-change