Virsh qemu kvm editing xml has no effect

kvm-virtualizationlibvirtqemuvirtual-machines

When I try to add a network section to a kvm/qemu xml, the xml wont update with the information.

When I edit the uuid, or make a mistake, i get an error. if i change the memory amount, it reverts to the original also.

I try editing with dump-xml vm vm.xml and define vm.xml, and also with edit vm.xml, neither works.

I've mostly been editing with the vm shut off

How do I edit my xml so changes take effect?

Sorry for my error. When I update the memory amount while also adding a network section, the memory amount changes while the network section isn't added.

Best Answer

From the man page:

define file

a domain from an XML <file>. The domain definition is registered but
not started. If domain is already running, the changes will take
effect on the next boot.

edit domain

Edit the XML configuration file for a domain, which will affect the
next boot of the guest. This is equivalent to: 

virsh dumpxml --inactive --security-info domain > domain.xml vi
domain.xml (or make changes with your other text editor) virsh define
domain.xml except that it does some error checking.

It's not possible to edit the XML without restarting.

For editing networks, net-update might work: virsh net-update default add ip-dhcp-host "<host mac='32:34:30:30:30:30' name='vm1' ip='192.168.122.30' />" --live --config But depending on your libvirt version, even that doesn't make libvirt give the server a new ip instantly (this has something to do with dnsmasq not reloading / restarting).