Skip to main content

@magistr/libvirt

v2026.03.04.1

Comprehensive libvirt/virsh management over SSH — VMs, networks, storage pools, volumes, snapshots, and host info

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

ArgumentTypeDescription
hoststringSSH host/IP of the libvirt hypervisor
userstringSSH 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.)
ArgumentTypeDescription
cap?stringFilter 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

ArgumentTypeDescription
hoststringSSH host/IP of the libvirt hypervisor
userstringSSH username (default: root)
listList all virtual networks
getGet detailed info for a virtual network including XML config
ArgumentTypeDescription
namestringNetwork name
dumpxmlGet raw XML definition of a network
ArgumentTypeDescription
namestringNetwork name
startStart (activate) a virtual network
ArgumentTypeDescription
namestringNetwork name
stopStop (deactivate) a virtual network
ArgumentTypeDescription
namestringNetwork name
defineDefine a virtual network from XML (does not start it)
ArgumentTypeDescription
xmlstringFull libvirt network XML definition
undefineUndefine a virtual network (remove persistent config)
ArgumentTypeDescription
namestringNetwork name
autostartEnable or disable autostart for a virtual network
ArgumentTypeDescription
namestringNetwork name
enabledbooleantrue to enable, false to disable
dhcpLeasesList DHCP leases for a virtual network
ArgumentTypeDescription
namestringNetwork 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

ArgumentTypeDescription
hoststringSSH host/IP of the libvirt hypervisor
userstringSSH username (default: root)
poolListList all storage pools
poolGetGet detailed info for a storage pool including XML
ArgumentTypeDescription
namestringPool name
poolStartStart (activate) a storage pool
ArgumentTypeDescription
namestringPool name
poolStopStop (deactivate) a storage pool
ArgumentTypeDescription
namestringPool name
poolDefineDefine a storage pool from parameters
ArgumentTypeDescription
namestringPool name
typeenumPool type
target?stringTarget path (e.g. /var/lib/libvirt/images)
sourceHost?stringSource host for network pools
sourcePath?stringSource path/name
sourceFormat?stringSource format (e.g. nfs, cifs, auto)
poolUndefineUndefine a storage pool (remove persistent config)
ArgumentTypeDescription
namestringPool name
poolAutostartEnable or disable autostart for a storage pool
ArgumentTypeDescription
namestringPool name
enabledbooleantrue to enable, false to disable
poolRefreshRefresh a storage pool to discover new volumes
ArgumentTypeDescription
namestringPool name
volListList all volumes in a storage pool
ArgumentTypeDescription
poolstringPool name
volGetGet detailed info for a storage volume including XML
ArgumentTypeDescription
namestringVolume name
poolstringPool name
volCreateCreate a new storage volume
ArgumentTypeDescription
poolstringPool name
namestringVolume name
capacitystringCapacity with unit (e.g. 10G, 500M, 1T)
formatenumVolume format
allocation?stringInitial allocation with unit (for thin provisioning, e.g. 0)
volDeleteDelete a storage volume
ArgumentTypeDescription
namestringVolume name
poolstringPool name
volResizeResize a storage volume
ArgumentTypeDescription
namestringVolume name
poolstringPool name
capacitystringNew capacity with unit (e.g. 20G)
shrinkbooleanAllow shrinking (data loss risk)
volCloneClone a storage volume
ArgumentTypeDescription
namestringSource volume name
poolstringPool name
newNamestringNew 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

ArgumentTypeDescription
hoststringSSH host/IP of the libvirt hypervisor
userstringSSH username (default: root)
listList all VMs with state, vCPUs, memory, and autostart
getGet detailed VM info including disks, NICs, and graphics
ArgumentTypeDescription
namestringVM name
dumpxmlGet raw XML definition of a VM
ArgumentTypeDescription
namestringVM name
startStart a VM
ArgumentTypeDescription
namestringVM name
stopGracefully shut down a VM (ACPI shutdown signal)
ArgumentTypeDescription
namestringVM name
forceStopForce stop a VM (like pulling the power cord)
ArgumentTypeDescription
namestringVM name
restartReboot a running VM
ArgumentTypeDescription
namestringVM name
resetHard reset a VM (no ACPI, immediate reset)
ArgumentTypeDescription
namestringVM name
suspendSuspend (pause) a running VM
ArgumentTypeDescription
namestringVM name
resumeResume a suspended (paused) VM
ArgumentTypeDescription
namestringVM name
autostartEnable or disable autostart for a VM
ArgumentTypeDescription
namestringVM name
enabledbooleantrue to enable, false to disable
defineDefine a VM from an XML definition (does not start it)
ArgumentTypeDescription
xmlstringFull libvirt domain XML definition
undefineUndefine a VM (remove its persistent configuration)
ArgumentTypeDescription
namestringVM name
removeStoragebooleanAlso remove all associated storage volumes
snapshotsMetadatabooleanAlso remove snapshot metadata
renameRename a VM (must be shut off)
ArgumentTypeDescription
namestringCurrent VM name
newNamestringNew VM name
saveSave VM state to a file (like hibernate)
ArgumentTypeDescription
namestringVM name
filestringPath on hypervisor to save state to
restoreRestore a VM from a saved state file
ArgumentTypeDescription
filestringPath on hypervisor to restore from
setVcpusChange the number of virtual CPUs
ArgumentTypeDescription
namestringVM name
countnumberNumber of vCPUs
configbooleanApply to persistent config (next boot)
livebooleanApply to running VM (hotplug)
setMemoryChange memory allocation (in MiB)
ArgumentTypeDescription
namestringVM name
sizeMBnumberMemory in MiB
maximumbooleanSet maximum memory instead of current
configbooleanApply to persistent config
livebooleanApply to running VM
attachDiskAttach a disk device to a VM
ArgumentTypeDescription
namestringVM name
sourcestringDisk source path (image file or block device)
targetstringTarget device name (e.g. vdb, sdb)
driverenumDisk driver/format
cache?enumCache mode
persistentbooleanMake change persistent across reboots
detachDiskDetach a disk device from a VM
ArgumentTypeDescription
namestringVM name
targetstringTarget device name to detach (e.g. vdb)
persistentbooleanMake change persistent
attachInterfaceAttach a network interface to a VM
ArgumentTypeDescription
namestringVM name
typeenumInterface type
sourcestringSource bridge/network name (e.g. br0, default)
modelstringNIC model (virtio, e1000, rtl8139)
persistentbooleanMake change persistent
detachInterfaceDetach a network interface from a VM by MAC address
ArgumentTypeDescription
namestringVM name
typeenumInterface type
macstringMAC address of the interface to detach
persistentbooleanMake change persistent
changeMediaChange CD/DVD media for a VM
ArgumentTypeDescription
namestringVM name
targetstringTarget device (e.g. hda, sda)
source?stringNew ISO path (omit to eject)
blockListList all block devices for a VM
ArgumentTypeDescription
namestringVM name
interfaceListList all network interfaces for a VM
ArgumentTypeDescription
namestringVM name
interfaceAddressesGet IP addresses of a VM's interfaces
ArgumentTypeDescription
namestringVM name
sourceenumAddress source: lease (DHCP), agent (guest-agent), arp
blockStatsGet block device I/O statistics for a VM
ArgumentTypeDescription
namestringVM name
device?stringSpecific block device (e.g. vda). Omit for all.
interfaceStatsGet network interface statistics for a VM
ArgumentTypeDescription
namestringVM name
interfacestringInterface device name (e.g. vnet0)
memoryStatsGet memory statistics for a VM
ArgumentTypeDescription
namestringVM name
cpuStatsGet CPU statistics for a VM
ArgumentTypeDescription
namestringVM name
domstatsGet comprehensive statistics for a VM (state, CPU, balloon, vCPU, net, block)
ArgumentTypeDescription
namestringVM name
snapshotListList all snapshots for a VM
ArgumentTypeDescription
namestringVM name
snapshotCreateCreate a snapshot of a VM
ArgumentTypeDescription
namestringVM name
snapshotNamestringName for the snapshot
description?stringSnapshot description
quiescebooleanQuiesce guest filesystem (requires guest agent)
diskOnlybooleanDisk-only snapshot (no memory)
snapshotInfoGet info about a specific snapshot
ArgumentTypeDescription
namestringVM name
snapshotNamestringSnapshot name
snapshotRevertRevert a VM to a snapshot
ArgumentTypeDescription
namestringVM name
snapshotNamestringSnapshot name to revert to
runningbooleanStart VM after revert
pausedbooleanLeave VM paused after revert
snapshotDeleteDelete a snapshot
ArgumentTypeDescription
namestringVM name
snapshotNamestringSnapshot name to delete
childrenbooleanAlso delete child snapshots
snapshotDumpxmlGet raw XML of a snapshot
ArgumentTypeDescription
namestringVM name
snapshotNamestringSnapshot name
guestInfoQuery guest information via QEMU guest agent (hostname, OS, IPs, filesystems, etc.)
ArgumentTypeDescription
namestringVM name
types?stringComma-separated types: users, os, timezone, hostname, filesystem, disk, interface (omit for all)
setUserPasswordSet a user password inside the guest (requires guest agent)
ArgumentTypeDescription
namestringVM name
usernamestringUsername inside the guest
passwordstringNew password
encryptedbooleanPassword 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)