]> git.ipfire.org Git - thirdparty/libvirt.git/commit
{domain, network}_conf: disable autostart when deleting config
authorMichael Chapman <mike@very.puzzling.org>
Wed, 11 Mar 2015 02:20:28 +0000 (13:20 +1100)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 15:06:39 +0000 (11:06 -0400)
commit2206ec869bd6b931c9d59242260c0b62ca11b73a
tree0cf51489a25428014b5ff0d69bdd5c1f6e5af220
parent5f3db971685235b5a8233d83ded217e59c1f6292
{domain, network}_conf: disable autostart when deleting config

Undefining a running, autostarted domain removes the autostart link, but
dom->autostart is not cleared. If the domain is subsequently redefined,
libvirt thinks it is already autostarted and will not create the link
even if requested:

  # virsh dominfo example | grep Autostart
  Autostart:      enable

  # ls /etc/libvirt/qemu/autostart/example.xml
  /etc/libvirt/qemu/autostart/example.xml

  # virsh undefine example
  Domain example has been undefined

  # virsh define example.xml
  Domain example defined from example.xml

  # virsh dominfo example | grep Autostart
  Autostart:      enable

  # virsh autostart example
  Domain example marked as autostarted

  # ls /etc/libvirt/qemu/autostart/example.xml
  ls: cannot access /etc/libvirt/qemu/autostart/example.xml: No such file or directory

This commit ensures dom->autostart is cleared whenever the config and
autostart link (if present) are removed.

The bridge network driver cleared this flag itself in networkUndefine.
This commit moves this into virNetworkDeleteConfig for symmetry with
virDomainDeleteConfig, and to ensure it is not missed in future network
drivers.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
(cherry picked from commit a6ec4f472d585c0ab3df42b98926fb8c6893d6e4)
src/conf/domain_conf.c
src/conf/network_conf.c
src/network/bridge_driver.c