My KVM VIRSH CheatSheet

sudo virsh list --all
sudo virsh list
sudo virsh dominfo domainname


#Rename Domain
virsh domrename currentname newname

#Edit domain config xml
sudo virsh edit domainname

#Open remote VNC to domain
#Add below XML contents within block (Accessible from outside)


sudo virsh start domainname
sudo virsh autostart domainname
sudo virsh autostart --disable domainname

#Force shutdown
sudo virsh destroy

#Clean Shutdown all
for i in sudo virsh list | grep running | awk '{print $2}' do
sudo virsh shutdown $i
done

Reboot domain

sudo virsh reboot domainname

#Save domain
sudo virsh save domainname /slowstore/data/domainname.saved
sudo virsh restore /slowstore/data/domainname.saved


Move VM
virsh dumpxml VMNAME > filename.xml
virsh define --file filename.xml
move qcow file
attached qcow to disk


virsh console VMNAME


virsh snapshot-create-as --domain Forums --name Forums_snap --description “fixing_network”

virsh snapshot-list webserver
virsh snapshot-revert {vm_name} {snapshot_name}
virsh snapshot-delete --domain webserver --snapshotname webserver_snap