User Tools

Site Tools


virtualization:libvirt

This is an old revision of the document!


LIBVIRT
virsh cheatsheet:http://blog.programster.org/kvm-cheatsheet/External Link

BASIC OPERATIONS

virsh shutdown guest1 --mode acpi
virsh suspend guest1
virsh reset guest1
virsh managedsave guest1 --running # to save running state.
virsh start guest1      # starts it from the point it was saved


Hypervisor level network definitions (xml) are in:

/usr/share/libvirt/networks/


If you edit the network with “virsh net-edit”, any changes you make won't take effect until the network is destroyed and re-started, which unfortunately will cause a all guests to lose network connectivity with the host until their network interfaces are explicitly re-attached.
SOMETIMES the only way is to produce an xml file of the current network with xmldump, destroy-undefine it , modify the xml and then define and start it!
XML config can be reloaded & activated:

virsh net-define /usr/share/libvirt/networks/default.xml

Network default defined from /usr/share/libvirt/networks/default.xml

virsh net-autostart default

Network default marked as autostarted

virsh net-start default

Network default started

Deactivate and then remove a network:

virsh net-destroy <name> 
virsh net-undefine <name>



Editing the attributes of a Virtual Machine

$ virsh dumpxml foo > /tmp/foo.xml
$ virsh define /tmp/foo.xml

Logs location:

virtualization/libvirt.1518193069.txt.gz · Last modified: (external edit)