[libvirt] [PATCH] 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. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1230071 --- src/lxc/lxc_process.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 87ee484..e99b039 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -137,6 +137,23 @@ virLXCProcessReboot(virLXCDriverPtr driver, } +static void +lxcProcessRemoveDomainStatus(virLXCDriverConfigPtr cfg, + virDomainObjPtr vm) +{ + char ebuf[1024]; + char *file = NULL; + + if (virAsprintf(&file, "%s/%s.xml", cfg->stateDir, vm->def->name) < 0) + return; + + if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR) + VIR_WARN("Failed to remove domain XML for %s: %s", + vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf))); + VIR_FREE(file); +} + + /** * virLXCProcessCleanup: * @driver: pointer to driver structure @@ -180,7 +197,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver, } virPidFileDelete(cfg->stateDir, vm->def->name); - virDomainDeleteConfig(cfg->stateDir, NULL, vm); + lxcProcessRemoveDomainStatus(cfg, vm); virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason); vm->pid = -1; -- 2.4.5

On Tue, Jul 28, 2015 at 06:28:58PM +0200, Peter Krempa wrote:
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.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1230071 --- src/lxc/lxc_process.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Tue, Jul 28, 2015 at 17:44:43 +0100, Daniel Berrange wrote:
On Tue, Jul 28, 2015 at 06:28:58PM +0200, Peter Krempa wrote:
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.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1230071 --- src/lxc/lxc_process.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
ACK
Pushed; Thanks. Peter
participants (2)
-
Daniel P. Berrange
-
Peter Krempa