virsh qemu kvm editing xml has no effect

17,390

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).

Share:
17,390

Related videos on Youtube

noob
Author by

noob

I enjoy using linux, but don't know nearly enough to do what I want to be able to do with it, so I keep trying to do new things.

Updated on September 18, 2022

Comments

  • noob
    noob over 1 year

    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.

  • noob
    noob about 8 years
    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
    noob about 8 years
    Yes, I've been trying both the virsh edit command, and the virsh define command.
  • Marco
    Marco about 8 years
    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
  • noob
    noob about 8 years
    And libvirt removes the section automatically. Thankyou for your help.