$ virsh list --all
$ virsh list --inactive
$ virsh list --uuid
$ virsh list --name
$ virsh list --state-running
$ virsh list --state-paused
$ virsh list --persistent
$ virsh list --with-snapshot
$ virsh list --autostart
$ virsh list --help
To Check Node info
$ virsh nodeinfo
To Check Domain Error
$ virsh domblkerror <vm_name>
To check a domain information
$ virsh dominfo <vm_name>
To Check Node CPU Stats
$ virsh nodecpustats
To Check Node Memory Stats
$ virsh nodememstats
To Check Node hostname
$ virsh hostname
To start vm
$ virsh start <vm_name>
To set a vm to start automatically on system startup
$ virsh autostart <vm_name>
To disable autostart
$ virsh autostart --disable <vm_name>
To shutdown a running vm
$ virsh shutdown <vm_name>
To make forceful shutdown of vm
$ virsh destroy <vm_name>
To restart a vm
$ virsh reboot <vm_name>
To suspend a vm
$ virsh suspend <vm_name>
To restore a suspended vm
$ virsh resume <vm_name>
To save the current state of a vm
$ virsh save vm_name vm_name.save
To restore saved vm from the file
$ virsh restore vm_name.save
To create a 3GB volume named vol2 on the default storage pool
$ virsh vol-create-as default vol2.qcow2 3G
To List volumes
$ virsh vol-list --pool default
$ virsh vol-list --pool images
To attach created volume
$ virsh attach-disk --domain <vm_name> \
--source /var/lib/libvirt/images/vol2.qcow2 \
--persistent --target vdb
$ virsh detach-disk --domain <vm_name> --persistent --live --target vdb
To List storage pools
$ virsh pool-list
To delete volume
$ sudo virsh vol-delete vol2.qcow2 --pool default
To create a snapshot
$ virsh snapshot-create-as \
--domain <vm_name> \
--name "vm_snapshot1" \
--description "vm_name snapshot 1-working"
To list available snapshots
$ virsh snapshot-list <vm_name>
To display info about a snapshot
$ virsh snapshot-info --domain <vm_name> --snapshotname vm_snapshot1
To revert the snapshot
$ virsh snapshot-revert --domain <vm_name> --snapshotname vm_snapshot1 --running
To delete snapshot
$ virsh snapshot-delete --domain <vm_name> --snapshotname vm_snapshot1
To clone a vm
$ virt-clone --connect qemu:///system \
--original vm_name \
--name vm_name_clone \
--file /var/lib/libvirt/images/vm_name_clone.qcow2
To manage VM vcpus
$ virsh setvcpus --domain vm_name --maximum 2 --config
$ virsh setvcpus --domain vm_name --count 2 --config
To manage VM memory
$ virsh setmaxmem <vm_name> 2048 --config
$ virsh setmem <vm_name> 2048 --config
regards,
T.Dhanasekar