please note, this is a regression issue and not reproducible with libvirt 1.2.8-16 description: cannot "autostart --disable" a lxc vm in shutoff status, if the lxc vm experienced a "running" state between the "autostart --disable" and previous "autostart" versions: libvirt-1.2.16-1.el7.x86_64 qemu-kvm-rhev-2.3.0-2.el7.x86_64 kernel-3.10.0-254.el7.x86_64 How reproduced: 100% steps: 1. # virsh -c lxc:// # virsh # list --all Id Name State ---------------------------------------------------- - lxc shut off 2. make sure lxc in shutoff state 2.1 virsh # destroy lxc Domain lxc destroyed 2.2 check the lxc autostart files # ll /etc/libvirt/lxc/autostart/ total 0 3. set lxc to autostart 3.1 virsh # autostart lxc Domain lxc marked as autostarted 3.2 check the lxc autostart files, it appears # ll /etc/libvirt/lxc/autostart/ total 0 lrwxrwxrwx. 1 root root 24 Jun 10 14:59 lxc.xml -> /etc/libvirt/lxc/lxc.xml 4. start lxc and check the autostart file virsh # start lxc Domain lxc started # ll /etc/libvirt/lxc/autostart/ total 0 lrwxrwxrwx. 1 root root 24 Jun 10 14:59 lxc.xml -> /etc/libvirt/lxc/lxc.xml 5. destroy lxc and check the autostart file virsh # destroy lxc Domain lxc destroyed # ll /etc/libvirt/lxc/autostart/ total 0 lrwxrwxrwx. 1 root root 24 Jun 10 14:59 lxc.xml -> /etc/libvirt/lxc/lxc.xml 6. disable the autostart for lxc (in shutoff state) 6.1 disable autostart virsh # autostart lxc --disable Domain lxc unmarked as autostarted 6.2 check the autostart file # ll /etc/libvirt/lxc/autostart/ total 0 lrwxrwxrwx. 1 root root 24 Jun 10 14:59 lxc.xml -> /etc/libvirt/lxc/lxc.xml <==== it's still exist, and when service libvirtd restart, lxc will be running. additional info: During the test, this issue can reproduced with following 2 conditions: 1. when run autostart --disable, lxc is in shutoff state. 2. between autostart and autostart --disable, the lxc should have experienced a running state. So following situations also reproduced the bug 1. start lxc; autostart lxc; destroy lxc; autostart --disable lxc 2. autostart lxc; start lxc; destroy lxc; autostart --disable lxc Following situations cannnot reproduce this issue, 1. start lxc; autostart lxc; autostart --disable lxc; destroy lxc 2. destroy lxc; autostart lxc; autostart --disable lxc; start lxc
Fixed upstream: commit dbb0baa5a74cecdac332f3d9d82f33cf517af8dd Author: Peter Krempa <pkrempa> Date: Tue Jul 28 18:25:59 2015 +0200 lxc: Don't accidentaly reset autostart flag in virLXCProcessCleanup virDomainDeleteConfig is meant to delete the persistent config and thus it resets vm->autostart. Copy parts of qemuProcessRemoveDomainStatus to a new helper to avoid using the incorrect function. Upcomming resease will fix this problem