fn list()
List all VMs with state, vCPUs, memory, and autostart
fn get(name: string)
Get detailed VM info including disks, NICs, and graphics
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn dumpxml(name: string)
Get raw XML definition of a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn start(name: string)
Start a VM. Idempotent — succeeds if already running.
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn stop(name: string)
Gracefully shut down a VM (ACPI) and wait until it is actually shut off before returning. Idempotent — succeeds if already stopped.
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn forceStop(name: string)
Force stop a VM (pull the power cord). Idempotent — succeeds if already stopped.
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn restart(name: string)
Reboot a running VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn reset(name: string)
Hard reset a VM (no ACPI, immediate reset)
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn suspend(name: string)
Suspend (pause) a running VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn resume(name: string)
Resume a suspended (paused) VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn autostart(name: string, enabled: boolean)
Enable or disable autostart for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| enabled | boolean | yes | true to enable, false to disable |
fn define(xml: string)
Define a VM from XML. Idempotent: undefines an existing domain of the same name first, then redefines.
| Argument | Type | Required | Description |
|---|
| xml | string | yes | Full libvirt domain XML definition |
fn undefine(name: string, removeStorage: boolean, snapshotsMetadata: boolean, nvram: boolean)
Undefine a VM (remove its persistent configuration)
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| removeStorage | boolean | yes | Also remove all associated storage volumes |
| snapshotsMetadata | boolean | yes | Also remove snapshot metadata |
| nvram | boolean | yes | Also remove NVRAM file (required for UEFI VMs) |
fn rename(name: string, newName: string)
Rename a VM (must be shut off)
| Argument | Type | Required | Description |
|---|
| name | string | yes | Current VM name |
| newName | string | yes | New VM name |
fn save(name: string, file: string)
Save VM state to a file (like hibernate)
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| file | string | yes | Path on hypervisor to save state to |
fn restore(file: string)
Restore a VM from a saved state file
| Argument | Type | Required | Description |
|---|
| file | string | yes | Path on hypervisor to restore from |
fn setVcpus(name: string, count: number, maximum: boolean, config: boolean, live: boolean)
Change the number of virtual CPUs
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| count | number | yes | Number of vCPUs |
| maximum | boolean | yes | Set maximum vCPU count instead of current |
| config | boolean | yes | Apply to persistent config (next boot) |
| live | boolean | yes | Apply to running VM (hotplug) |
fn setMemory(name: string, sizeMB: number, maximum: boolean, config: boolean, live: boolean)
Change memory allocation (in MiB)
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| sizeMB | number | yes | Memory in MiB |
| maximum | boolean | yes | Set maximum memory instead of current |
| config | boolean | yes | Apply to persistent config |
| live | boolean | yes | Apply to running VM |
fn attachDisk(name: string, source: string, target: string, driver: enum, cache?: enum, persistent: boolean, config: boolean)
Attach a disk device to a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| source | string | yes | Disk source path (image file or block device) |
| target | string | yes | Target device name (e.g. vdb, sdb) |
| driver | enum | yes | Disk driver/format |
| cache? | enum | no | Cache mode |
| persistent | boolean | yes | Make change persistent across reboots (running VMs) |
| config | boolean | yes | Apply to persistent config only (stopped VMs) |
fn detachDisk(name: string, target: string, persistent: boolean, config: boolean)
Detach a disk device from a VM. Idempotent: succeeds if disk not found.
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| target | string | yes | Target device name to detach (e.g. vdb) |
| persistent | boolean | yes | Make change persistent (running VMs) |
| config | boolean | yes | Apply to persistent config only (stopped VMs) |
fn attachInterface(name: string, type: enum, source: string, model: string, persistent: boolean)
Attach a network interface to a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| type | enum | yes | Interface type |
| source | string | yes | Source bridge/network name (e.g. br0, default) |
| model | string | yes | NIC model (virtio, e1000, rtl8139) |
| persistent | boolean | yes | Make change persistent |
fn detachInterface(name: string, type: enum, mac: string, persistent: boolean)
Detach a network interface from a VM by MAC address
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| type | enum | yes | Interface type |
| mac | string | yes | MAC address of the interface to detach |
| persistent | boolean | yes | Make change persistent |
fn changeMedia(name: string, target: string, source?: string)
Change CD/DVD media for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| target | string | yes | Target device (e.g. hda, sda) |
| source? | string | no | New ISO path (omit to eject) |
fn blockList(name: string)
List all block devices for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn interfaceList(name: string)
List all network interfaces for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn interfaceAddresses(name: string, source: enum)
Get IP addresses of a VM's interfaces
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| source | enum | yes | Address source: lease (DHCP), agent (guest-agent), arp |
fn blockStats(name: string, device?: string)
Get block device I/O statistics for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| device? | string | no | Specific block device (e.g. vda). Omit for all. |
fn interfaceStats(name: string, interface: string)
Get network interface statistics for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| interface | string | yes | Interface device name (e.g. vnet0) |
fn memoryStats(name: string)
Get memory statistics for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn cpuStats(name: string)
Get CPU statistics for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn domstats(name: string)
Get comprehensive statistics for a VM (state, CPU, balloon, vCPU, net, block)
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn snapshotList(name: string)
List all snapshots for a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
fn snapshotCreate(name: string, snapshotName: string, description?: string, quiesce: boolean, diskOnly: boolean)
Create a snapshot of a VM
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| snapshotName | string | yes | Name for the snapshot |
| description? | string | no | Snapshot description |
| quiesce | boolean | yes | Quiesce guest filesystem (requires guest agent) |
| diskOnly | boolean | yes | Disk-only snapshot (no memory) |
fn snapshotInfo(name: string, snapshotName: string)
Get info about a specific snapshot
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| snapshotName | string | yes | Snapshot name |
fn snapshotRevert(name: string, snapshotName: string, running: boolean, paused: boolean)
Revert a VM to a snapshot
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| snapshotName | string | yes | Snapshot name to revert to |
| running | boolean | yes | Start VM after revert |
| paused | boolean | yes | Leave VM paused after revert |
fn snapshotDelete(name: string, snapshotName: string, children: boolean)
Delete a snapshot
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| snapshotName | string | yes | Snapshot name to delete |
| children | boolean | yes | Also delete child snapshots |
fn snapshotDumpxml(name: string, snapshotName: string)
Get raw XML of a snapshot
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| snapshotName | string | yes | Snapshot name |
fn guestInfo(name: string, types?: string)
Query guest information via QEMU guest agent (hostname, OS, IPs, filesystems, etc.)
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| types? | string | no | Comma-separated types: users, os, timezone, hostname, filesystem, disk, interface (omit for all) |
fn setUserPassword(name: string, username: string, password: string, encrypted: boolean)
Set a user password inside the guest (requires guest agent). NOTE: the password is passed as a virsh argument and is visible in the hypervisor's process list while running — see README limitations.
| Argument | Type | Required | Description |
|---|
| name | string | yes | VM name |
| username | string | yes | Username inside the guest |
| password | string | yes | New password |
| encrypted | boolean | yes | Password is already encrypted/hashed |