[libvirt] [PATCH 0/2] Domain lifecycle onCrash adjustments

First patch uses the right symbols, second patch adds an extra check to qemu backend for the coredump-destroy action John Ferlan (2): Use the correct symbol for 'onCrash' qemu: Add missing on_crash lifecycle type src/lxc/lxc_native.c | 2 +- src/qemu/qemu_command.c | 5 +++-- src/vmx/vmx.c | 2 +- src/xenconfig/xen_sxpr.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) -- 2.1.0

Although defined the same way, fortunately there hadn't been any deviation. Ensure any assignments to onCrash use VIR_DOMAIN_LIFECYCLE_CRASH_* defs and not VIR_DOMAIN_LIFECYCLE_* defs Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/lxc/lxc_native.c | 2 +- src/qemu/qemu_command.c | 4 ++-- src/vmx/vmx.c | 2 +- src/xenconfig/xen_sxpr.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 1069236..6faa701 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -1013,7 +1013,7 @@ lxcParseConfigString(const char *config) virDomainDefSetMemoryInitial(vmdef, 64 * 1024); vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART; - vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY; + vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; vmdef->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY; vmdef->virtType = VIR_DOMAIN_VIRT_LXC; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9b06a49..443a7d7 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9381,7 +9381,7 @@ qemuBuildCommandLine(virConnectPtr conn, /* Only add -no-reboot option if each event destroys domain */ if (def->onReboot == VIR_DOMAIN_LIFECYCLE_DESTROY && def->onPoweroff == VIR_DOMAIN_LIFECYCLE_DESTROY && - def->onCrash == VIR_DOMAIN_LIFECYCLE_DESTROY) { + def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY) { allowReboot = false; virCommandAddArg(cmd, "-no-reboot"); } @@ -12603,7 +12603,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC; def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART; - def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY; def->virtType = VIR_DOMAIN_VIRT_QEMU; if (VIR_STRDUP(def->emulator, progargv[0]) < 0) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index aede2ad..e77de62 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1519,7 +1519,7 @@ virVMXParseConfig(virVMXContext *ctx, /* def:lifecycle */ def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART; def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY; - def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; /* def:os */ def->os.type = VIR_DOMAIN_OSTYPE_HVM; diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index 8985295..05e938a 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1208,7 +1208,7 @@ xenParseSxpr(const struct sexpr *root, goto error; } } else { - def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; } if (hvm) { -- 2.1.0

https://bugzilla.redhat.com/show_bug.cgi?id=1201760 When the domain "<on_crash>coredump-destroy</on_crash>" is set, the domain wasn't being destroyed, rather it was being rebooted. Add VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY to the list of on_crash types that cause "-no-reboot" to be added to the qemu command line. Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 443a7d7..c8f8fe8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9381,7 +9381,8 @@ qemuBuildCommandLine(virConnectPtr conn, /* Only add -no-reboot option if each event destroys domain */ if (def->onReboot == VIR_DOMAIN_LIFECYCLE_DESTROY && def->onPoweroff == VIR_DOMAIN_LIFECYCLE_DESTROY && - def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY) { + (def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY || + def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY)) { allowReboot = false; virCommandAddArg(cmd, "-no-reboot"); } -- 2.1.0

On 30.06.2015 12:58, John Ferlan wrote:
First patch uses the right symbols, second patch adds an extra check to qemu backend for the coredump-destroy action
John Ferlan (2): Use the correct symbol for 'onCrash' qemu: Add missing on_crash lifecycle type
src/lxc/lxc_native.c | 2 +- src/qemu/qemu_command.c | 5 +++-- src/vmx/vmx.c | 2 +- src/xenconfig/xen_sxpr.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-)
ACK and safe for the freeze. Fortunately, both old (wrong) and new (correct) values are at the beginning of their enums so they have the same value. Michal
participants (2)
-
John Ferlan
-
Michal Privoznik