virsh cheat sheet

list guests:

virsh list --all

Show guests info:

virsh dominfo $vmname

Start guest:

virsh start $vmname

Shutdown guest:

virsh shutdown $vmname

Poweroff guest:

virsh destroy $vmname

Suspend guest:

virsh suspend $vmname

Resume guest:

virsh resume $vmname

Create guest from XML:

virsh create xml_file.xml

Dump guest XML:

virsh dumpxml $vmname

Modify guest:

virsh edit $vmname

Remove guest definition:

virsh undefine $vmname

Save guest state:

virsh save $vmname $state_file

Restore guest state:

virsh restore $state_file

Create guest:

virt-install --name=$vmname --arch=x86_64 --vcpus=1 --ram=1024 --os-type=linux --os-variant=generic26 --hvm --connect=qemu:///system --network bridge:virbr0 --cdrom=/where/ever/u/store/isos/arch.iso --disk path=/where/ever/u/wish/guest.img,size=20 --accelerate --vnc --noautoconsole --keymap=de

Migrate guest:

virsh migrate --live --copy-storage-inc --verbose $vmname qemu+ssh://destination/system

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.