Common virsh workflows
This page groups the virsh commands that usually travel together during provisioning, incident handling, and cleanup. Inventory and inspect first Do this before changing anything. list all Use virsh list all when you nee
This page groups the virsh commands that usually travel together during provisioning, incident handling, and cleanup.
Inventory and inspect first
Do this before changing anything.
virsh -c qemu:///system list --all
virsh dominfo vm01
virsh dumpxml vm01 | less
virsh domblklist vm01
virsh domiflist vm01list --all
Use virsh list --all when you need the authoritative inventory for the current URI, including shut off guests.
dumpxml
Use virsh dumpxml before assuming anything about disks, interfaces, firmware, consoles, or security labels.
Start, stop, and console access
virsh start vm01
virsh reboot vm01
virsh shutdown vm01
virsh destroy vm01
virsh console vm01Use shutdown first. Reserve destroy for the same situations where you would force-stop a process.
start
virsh start asks libvirt to boot a defined guest without forcing a configuration change.
shutdown
virsh shutdown is the graceful stop path and should be your default before you escalate to destroy.
Snapshot and migration checks
virsh snapshot-list vm01
virsh domjobinfo vm01
virsh migrate --live vm01 qemu+ssh://hv-b/systemSafe cleanup
virsh undefine vm01 --nvram
virsh undefine oldvm --remove-all-storageRead the XML and storage mapping before using the storage removal flags. They are convenient and easy to misuse.
connect
Use virsh connect URI when you want to switch the interactive shell to a different libvirt endpoint without restarting the client.