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.


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='' />" --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).

| improve this answer | |
  • Thankyou. When i use the edit command, changing the memory amount and adding a <network> section, the xml updates the memory amount but doesn't add the <network> section. – noob Mar 22 '16 at 22:56
  • there's no <network> section in a domains xml file. the <network> is defined in the networks xml. list networks with virsh net-list and dump the networks xml with virsh net-dumpxml <network_name>. see libvirt.org/formatdomain.html#elementsNICSVirtual and libvirt.org/formatnetwork.html – Marco Mar 23 '16 at 0:03
  • And libvirt removes the section automatically. Thankyou for your help. – noob Mar 23 '16 at 2:00

Have you been editing the xml directly? You're really supposed to run virsh edit VMNAME

| improve this answer | |
  • Yes, I've been trying both the virsh edit command, and the virsh define command. – noob Mar 22 '16 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.