@magistr/libvirt
v2026.03.04.1
Comprehensive libvirt/virsh management over SSH — VMs, networks, storage pools, volumes, snapshots, and host info
Contents
Quality score
How well-documented and verifiable this extension is.
Not yet scored.
A score will be generated the next time this extension is published. The owner can also trigger scoring manually.
Install
$ swamp extension pull @magistr/libvirt@magistr/libvirt/hostv2026.03.04.1libvirt_host.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| host | string | SSH host/IP of the libvirt hypervisor |
| user | string | SSH username (default: root) |
infoGet hypervisor host info (CPU, memory, versions)
capabilitiesGet hypervisor capabilities XML
sysinfoGet host system information (SMBIOS/DMI data)
cpuStatsGet host CPU usage statistics
memStatsGet host memory statistics
deviceListList node devices (PCI, USB, network, storage controllers, etc.)
| Argument | Type | Description |
|---|---|---|
| cap? | string | Filter by capability: system, pci, usb, usb_device, net, scsi_host, scsi, storage, drm |
Resources
info(infinite)— Hypervisor host information
stats(1h)— Host statistics (CPU, memory)
devices(infinite)— Node device list
@magistr/libvirt/networkv2026.03.04.1libvirt_network.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| host | string | SSH host/IP of the libvirt hypervisor |
| user | string | SSH username (default: root) |
listList all virtual networks
getGet detailed info for a virtual network including XML config
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
dumpxmlGet raw XML definition of a network
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
startStart (activate) a virtual network
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
stopStop (deactivate) a virtual network
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
defineDefine a virtual network from XML (does not start it)
| Argument | Type | Description |
|---|---|---|
| xml | string | Full libvirt network XML definition |
undefineUndefine a virtual network (remove persistent config)
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
autostartEnable or disable autostart for a virtual network
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
| enabled | boolean | true to enable, false to disable |
dhcpLeasesList DHCP leases for a virtual network
| Argument | Type | Description |
|---|---|---|
| name | string | Network name |
Resources
network(infinite)— Virtual network list or detail
dhcpLeases(1h)— DHCP leases for a network
actionResult(1h)— Result of a network action
@magistr/libvirt/storagev2026.03.04.1libvirt_storage.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| host | string | SSH host/IP of the libvirt hypervisor |
| user | string | SSH username (default: root) |
poolListList all storage pools
poolGetGet detailed info for a storage pool including XML
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
poolStartStart (activate) a storage pool
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
poolStopStop (deactivate) a storage pool
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
poolDefineDefine a storage pool from parameters
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
| type | enum | Pool type |
| target? | string | Target path (e.g. /var/lib/libvirt/images) |
| sourceHost? | string | Source host for network pools |
| sourcePath? | string | Source path/name |
| sourceFormat? | string | Source format (e.g. nfs, cifs, auto) |
poolUndefineUndefine a storage pool (remove persistent config)
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
poolAutostartEnable or disable autostart for a storage pool
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
| enabled | boolean | true to enable, false to disable |
poolRefreshRefresh a storage pool to discover new volumes
| Argument | Type | Description |
|---|---|---|
| name | string | Pool name |
volListList all volumes in a storage pool
| Argument | Type | Description |
|---|---|---|
| pool | string | Pool name |
volGetGet detailed info for a storage volume including XML
| Argument | Type | Description |
|---|---|---|
| name | string | Volume name |
| pool | string | Pool name |
volCreateCreate a new storage volume
| Argument | Type | Description |
|---|---|---|
| pool | string | Pool name |
| name | string | Volume name |
| capacity | string | Capacity with unit (e.g. 10G, 500M, 1T) |
| format | enum | Volume format |
| allocation? | string | Initial allocation with unit (for thin provisioning, e.g. 0) |
volDeleteDelete a storage volume
| Argument | Type | Description |
|---|---|---|
| name | string | Volume name |
| pool | string | Pool name |
volResizeResize a storage volume
| Argument | Type | Description |
|---|---|---|
| name | string | Volume name |
| pool | string | Pool name |
| capacity | string | New capacity with unit (e.g. 20G) |
| shrink | boolean | Allow shrinking (data loss risk) |
volCloneClone a storage volume
| Argument | Type | Description |
|---|---|---|
| name | string | Source volume name |
| pool | string | Pool name |
| newName | string | New cloned volume name |
Resources
pool(infinite)— Storage pool list or detail
volume(infinite)— Storage volume list or detail
actionResult(1h)— Result of a storage action
@magistr/libvirt/vmv2026.03.04.2libvirt_vm.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| host | string | SSH host/IP of the libvirt hypervisor |
| user | string | SSH username (default: root) |
listList all VMs with state, vCPUs, memory, and autostart
getGet detailed VM info including disks, NICs, and graphics
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
dumpxmlGet raw XML definition of a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
startStart a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
stopGracefully shut down a VM (ACPI shutdown signal)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
forceStopForce stop a VM (like pulling the power cord)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
restartReboot a running VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
resetHard reset a VM (no ACPI, immediate reset)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
suspendSuspend (pause) a running VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
resumeResume a suspended (paused) VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
autostartEnable or disable autostart for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| enabled | boolean | true to enable, false to disable |
defineDefine a VM from an XML definition (does not start it)
| Argument | Type | Description |
|---|---|---|
| xml | string | Full libvirt domain XML definition |
undefineUndefine a VM (remove its persistent configuration)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| removeStorage | boolean | Also remove all associated storage volumes |
| snapshotsMetadata | boolean | Also remove snapshot metadata |
renameRename a VM (must be shut off)
| Argument | Type | Description |
|---|---|---|
| name | string | Current VM name |
| newName | string | New VM name |
saveSave VM state to a file (like hibernate)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| file | string | Path on hypervisor to save state to |
restoreRestore a VM from a saved state file
| Argument | Type | Description |
|---|---|---|
| file | string | Path on hypervisor to restore from |
setVcpusChange the number of virtual CPUs
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| count | number | Number of vCPUs |
| config | boolean | Apply to persistent config (next boot) |
| live | boolean | Apply to running VM (hotplug) |
setMemoryChange memory allocation (in MiB)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| sizeMB | number | Memory in MiB |
| maximum | boolean | Set maximum memory instead of current |
| config | boolean | Apply to persistent config |
| live | boolean | Apply to running VM |
attachDiskAttach a disk device to a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| source | string | Disk source path (image file or block device) |
| target | string | Target device name (e.g. vdb, sdb) |
| driver | enum | Disk driver/format |
| cache? | enum | Cache mode |
| persistent | boolean | Make change persistent across reboots |
detachDiskDetach a disk device from a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| target | string | Target device name to detach (e.g. vdb) |
| persistent | boolean | Make change persistent |
attachInterfaceAttach a network interface to a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| type | enum | Interface type |
| source | string | Source bridge/network name (e.g. br0, default) |
| model | string | NIC model (virtio, e1000, rtl8139) |
| persistent | boolean | Make change persistent |
detachInterfaceDetach a network interface from a VM by MAC address
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| type | enum | Interface type |
| mac | string | MAC address of the interface to detach |
| persistent | boolean | Make change persistent |
changeMediaChange CD/DVD media for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| target | string | Target device (e.g. hda, sda) |
| source? | string | New ISO path (omit to eject) |
blockListList all block devices for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
interfaceListList all network interfaces for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
interfaceAddressesGet IP addresses of a VM's interfaces
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| source | enum | Address source: lease (DHCP), agent (guest-agent), arp |
blockStatsGet block device I/O statistics for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| device? | string | Specific block device (e.g. vda). Omit for all. |
interfaceStatsGet network interface statistics for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| interface | string | Interface device name (e.g. vnet0) |
memoryStatsGet memory statistics for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
cpuStatsGet CPU statistics for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
domstatsGet comprehensive statistics for a VM (state, CPU, balloon, vCPU, net, block)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
snapshotListList all snapshots for a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
snapshotCreateCreate a snapshot of a VM
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| snapshotName | string | Name for the snapshot |
| description? | string | Snapshot description |
| quiesce | boolean | Quiesce guest filesystem (requires guest agent) |
| diskOnly | boolean | Disk-only snapshot (no memory) |
snapshotInfoGet info about a specific snapshot
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| snapshotName | string | Snapshot name |
snapshotRevertRevert a VM to a snapshot
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| snapshotName | string | Snapshot name to revert to |
| running | boolean | Start VM after revert |
| paused | boolean | Leave VM paused after revert |
snapshotDeleteDelete a snapshot
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| snapshotName | string | Snapshot name to delete |
| children | boolean | Also delete child snapshots |
snapshotDumpxmlGet raw XML of a snapshot
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| snapshotName | string | Snapshot name |
guestInfoQuery guest information via QEMU guest agent (hostname, OS, IPs, filesystems, etc.)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| types? | string | Comma-separated types: users, os, timezone, hostname, filesystem, disk, interface (omit for all) |
setUserPasswordSet a user password inside the guest (requires guest agent)
| Argument | Type | Description |
|---|---|---|
| name | string | VM name |
| username | string | Username inside the guest |
| password | string | New password |
| encrypted | boolean | Password is already encrypted/hashed |
Resources
vm(infinite)— VM list or detail
actionResult(1h)— Result of a VM action (start, stop, etc.)
snapshot(infinite)— Snapshot list or detail
stats(1h)— VM statistics (block, interface, memory, CPU)