diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a9f63e9da9..18addcaf14 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -214,12 +214,6 @@ VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST, "crash") VIR_ENUM_IMPL(virDomainLifecycleAction, VIR_DOMAIN_LIFECYCLE_ACTION_LAST, - "destroy", - "restart", - "rename-restart", - "preserve") - -VIR_ENUM_IMPL(virDomainLifecycleCrash, VIR_DOMAIN_LIFECYCLE_CRASH_LAST, "destroy", "restart", "rename-restart", @@ -5618,6 +5612,60 @@ virDomainDefCheckDuplicateDriveAddresses(const virDomainDef *def) } +static bool +virDomainDefLifecycleActionAllowed(virDomainLifecycle type, + virDomainLifecycleAction action) +{ + switch (type) { + case VIR_DOMAIN_LIFECYCLE_POWEROFF: + case VIR_DOMAIN_LIFECYCLE_REBOOT: + switch (action) { + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: + return true; + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: + break; + } + break; + case VIR_DOMAIN_LIFECYCLE_CRASH: + case VIR_DOMAIN_LIFECYCLE_LAST: + return true; + } + + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Lifecycle event '%s' doesn't support '%s' action"), + virDomainLifecycleTypeToString(type), + virDomainLifecycleActionTypeToString(action)); + return false; +} + + +static int +virDomainDefLifecycleActionValidate(const virDomainDef *def) +{ + if (!virDomainDefLifecycleActionAllowed(VIR_DOMAIN_LIFECYCLE_POWEROFF, + def->onPoweroff)) { + return -1; + } + + if (!virDomainDefLifecycleActionAllowed(VIR_DOMAIN_LIFECYCLE_REBOOT, + def->onReboot)) { + return -1; + } + + if (!virDomainDefLifecycleActionAllowed(VIR_DOMAIN_LIFECYCLE_CRASH, + def->onCrash)) { + return -1; + } + + return 0; +} + + static int virDomainDefValidateInternal(const virDomainDef *def) { @@ -5648,6 +5696,9 @@ virDomainDefValidateInternal(const virDomainDef *def) return -1; } + if (virDomainDefLifecycleActionValidate(def) < 0) + return -1; + return 0; } @@ -18612,8 +18663,8 @@ virDomainDefParseXML(xmlDocPtr xml, if (virDomainEventActionParseXML(ctxt, "on_crash", "string(./on_crash[1])", &def->onCrash, - VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY, - virDomainLifecycleCrashTypeFromString) < 0) + VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, + virDomainLifecycleActionTypeFromString) < 0) goto error; if (virDomainEventActionParseXML(ctxt, "on_lockfailure", @@ -25876,7 +25927,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, goto error; if (virDomainEventActionDefFormat(buf, def->onCrash, "on_crash", - virDomainLifecycleCrashTypeToString) < 0) + virDomainLifecycleActionTypeToString) < 0) goto error; if (def->onLockFailure != VIR_DOMAIN_LOCK_FAILURE_DEFAULT && virDomainEventActionDefFormat(buf, def->onLockFailure, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index bc03c6ec17..38b966f6de 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1804,21 +1804,12 @@ typedef enum { VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME, VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE, + VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY, + VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART, VIR_DOMAIN_LIFECYCLE_ACTION_LAST } virDomainLifecycleAction; -typedef enum { - VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY, - VIR_DOMAIN_LIFECYCLE_CRASH_RESTART, - VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME, - VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE, - VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY, - VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART, - - VIR_DOMAIN_LIFECYCLE_CRASH_LAST -} virDomainLifecycleCrashAction; - typedef enum { VIR_DOMAIN_LOCK_FAILURE_DEFAULT, VIR_DOMAIN_LOCK_FAILURE_POWEROFF, @@ -3221,7 +3212,6 @@ VIR_ENUM_DECL(virDomainCapabilitiesPolicy) VIR_ENUM_DECL(virDomainCapsFeature) VIR_ENUM_DECL(virDomainLifecycle) VIR_ENUM_DECL(virDomainLifecycleAction) -VIR_ENUM_DECL(virDomainLifecycleCrash) VIR_ENUM_DECL(virDomainDevice) VIR_ENUM_DECL(virDomainDeviceAddress) VIR_ENUM_DECL(virDomainDiskDevice) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index aa7870fb46..d3cb05be6f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -403,8 +403,6 @@ virDomainLeaseRemove; virDomainLeaseRemoveAt; virDomainLifecycleActionTypeFromString; virDomainLifecycleActionTypeToString; -virDomainLifecycleCrashTypeFromString; -virDomainLifecycleCrashTypeToString; virDomainLoaderDefFree; virDomainLoaderTypeFromString; virDomainLoaderTypeToString; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 15111af0b7..ecbabfc797 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -110,38 +110,13 @@ libxlActionFromVirLifecycle(virDomainLifecycleAction action) case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: return LIBXL_ACTION_ON_SHUTDOWN_PRESERVE; - case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: - break; - } - - return 0; -} - - -static libxl_action_on_shutdown -libxlActionFromVirLifecycleCrash(virDomainLifecycleCrashAction action) -{ - - switch (action) { - case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: - return LIBXL_ACTION_ON_SHUTDOWN_DESTROY; - - case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART: - return LIBXL_ACTION_ON_SHUTDOWN_RESTART; - - case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME: - return LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME; - - case VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE: - return LIBXL_ACTION_ON_SHUTDOWN_PRESERVE; - - case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: return LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY; - case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: return LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART; - case VIR_DOMAIN_LIFECYCLE_CRASH_LAST: + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: break; } @@ -2247,7 +2222,7 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicsports, d_config->on_reboot = libxlActionFromVirLifecycle(def->onReboot); d_config->on_poweroff = libxlActionFromVirLifecycle(def->onPoweroff); - d_config->on_crash = libxlActionFromVirLifecycleCrash(def->onCrash); + d_config->on_crash = libxlActionFromVirLifecycle(def->onCrash); return 0; } diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 3b260ee15c..09bfc88f54 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -474,6 +474,8 @@ libxlDomainShutdownThread(void *opaque) case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: goto restart; case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; } @@ -484,19 +486,19 @@ libxlDomainShutdownThread(void *opaque) dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); - switch ((virDomainLifecycleCrashAction) vm->def->onCrash) { - case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: + switch ((virDomainLifecycleAction) vm->def->onCrash) { + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: goto destroy; - case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART: - case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: goto restart; - case VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE: - case VIR_DOMAIN_LIFECYCLE_CRASH_LAST: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; - case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: libxlDomainAutoCoreDump(driver, vm); goto destroy; - case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: libxlDomainAutoCoreDump(driver, vm); goto restart; } @@ -514,6 +516,8 @@ libxlDomainShutdownThread(void *opaque) case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: goto restart; case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; } diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 08f82f2580..68636dc2a4 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -1016,7 +1016,7 @@ lxcParseConfigString(const char *config, virDomainDefSetMemoryTotal(vmdef, 64 * 1024); vmdef->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; - vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; + vmdef->onCrash = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; vmdef->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; vmdef->virtType = VIR_DOMAIN_VIRT_LXC; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 865f136d3b..fab9746449 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6521,8 +6521,8 @@ qemuBuildPMCommandLine(virCommandPtr cmd, /* Only add -no-reboot option if each event destroys domain */ if (def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY && def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY && - (def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY || - def->onCrash == VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY)) { + (def->onCrash == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY || + def->onCrash == VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY)) { allowReboot = false; virCommandAddArg(cmd, "-no-reboot"); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ef283b1196..502b5b5fcd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4238,12 +4238,12 @@ processGuestPanicEvent(virQEMUDriverPtr driver, VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); switch (action) { - case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) goto endjob; ATTRIBUTE_FALLTHROUGH; - case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, QEMU_ASYNC_JOB_DUMP, 0); event = virDomainEventLifecycleNewFromObj(vm, @@ -4255,17 +4255,17 @@ processGuestPanicEvent(virQEMUDriverPtr driver, removeInactive = true; break; - case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) goto endjob; ATTRIBUTE_FALLTHROUGH; - case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: qemuDomainSetFakeReboot(driver, vm, true); qemuProcessShutdownOrReboot(driver, vm); break; - case VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: break; default: diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 42e03c7286..649c3b1ccf 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -1887,7 +1887,7 @@ qemuParseCommandLine(virCapsPtr caps, def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC; def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; - def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_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 2cb48bb729..622f22f037 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1580,7 +1580,7 @@ virVMXParseConfig(virVMXContext *ctx, /* def:lifecycle */ def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; - def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; /* def:os */ def->os.type = VIR_DOMAIN_OSTYPE_HVM; diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 9efb7b77ca..3910deeb3a 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1889,7 +1889,7 @@ prlsdkLoadDomain(vzDriverPtr driver, def->onReboot = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; def->onPoweroff = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; - def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; /* get RAM parameters */ pret = PrlVmCfg_GetRamSize(sdkdom, &ram); @@ -2593,7 +2593,7 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def) if (def->onReboot != VIR_DOMAIN_LIFECYCLE_ACTION_RESTART || def->onPoweroff != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY || - def->onCrash != VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY) { + def->onCrash != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("on_reboot, on_poweroff and on_crash parameters " diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c index c4bbecc336..cf5bf66732 100644 --- a/src/xenapi/xenapi_utils.c +++ b/src/xenapi/xenapi_utils.c @@ -140,20 +140,20 @@ actionShutdownLibvirt2XenapiEnum(virDomainLifecycleAction action) enum xen_on_crash_behaviour -actionCrashLibvirt2XenapiEnum(virDomainLifecycleCrashAction action) +actionCrashLibvirt2XenapiEnum(virDomainLifecycleAction action) { enum xen_on_crash_behaviour num = XEN_ON_CRASH_BEHAVIOUR_RESTART; - if (action == VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY) + if (action == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY) num = XEN_ON_CRASH_BEHAVIOUR_DESTROY; - else if (action == VIR_DOMAIN_LIFECYCLE_CRASH_RESTART) + else if (action == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART) num = XEN_ON_CRASH_BEHAVIOUR_RESTART; - else if (action == VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE) + else if (action == VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) num = XEN_ON_CRASH_BEHAVIOUR_PRESERVE; - else if (action == VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME) + else if (action == VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME) num = XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART; - else if (action == VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY) + else if (action == VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY) num = XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY; - else if (action == VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART) + else if (action == VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART) num = XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART; return num; } @@ -210,22 +210,22 @@ xenapiNormalExitEnum2virDomainLifecycle(enum xen_on_normal_exit action) } -virDomainLifecycleCrashAction +virDomainLifecycleAction xenapiCrashExitEnum2virDomainLifecycle(enum xen_on_crash_behaviour action) { - virDomainLifecycleCrashAction num = VIR_DOMAIN_LIFECYCLE_CRASH_RESTART; + virDomainLifecycleAction num = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; if (action == XEN_ON_CRASH_BEHAVIOUR_DESTROY) - num = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; + num = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; else if (action == XEN_ON_CRASH_BEHAVIOUR_RESTART) - num = VIR_DOMAIN_LIFECYCLE_CRASH_RESTART; + num = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; else if (action == XEN_ON_CRASH_BEHAVIOUR_PRESERVE) - num = VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE; + num = VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE; else if (action == XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART) - num = VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME; + num = VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME; else if (action == XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY) - num = VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY; + num = VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY; else if (action == XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART) - num = VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART; + num = VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART; return num; } diff --git a/src/xenapi/xenapi_utils.h b/src/xenapi/xenapi_utils.h index 26e1ac29c5..72c42d11ea 100644 --- a/src/xenapi/xenapi_utils.h +++ b/src/xenapi/xenapi_utils.h @@ -46,7 +46,7 @@ enum xen_on_normal_exit actionShutdownLibvirt2XenapiEnum(virDomainLifecycleAction action); enum xen_on_crash_behaviour -actionCrashLibvirt2XenapiEnum(virDomainLifecycleCrashAction action); +actionCrashLibvirt2XenapiEnum(virDomainLifecycleAction action); char * createXenAPIBootOrderString(int nboot, int *bootDevs); @@ -56,7 +56,7 @@ virDomainBootOrder map2LibvirtBootOrder(char c); virDomainLifecycleAction xenapiNormalExitEnum2virDomainLifecycle(enum xen_on_normal_exit action); -virDomainLifecycleCrashAction +virDomainLifecycleAction xenapiCrashExitEnum2virDomainLifecycle(enum xen_on_crash_behaviour action); void getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen); diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index a3b82c178e..8fc24b24eb 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -379,7 +379,7 @@ xenParseEventsActions(virConfPtr conf, virDomainDefPtr def) if (xenConfigGetString(conf, "on_crash", &str, "restart") < 0) return -1; - if ((def->onCrash = virDomainLifecycleCrashTypeFromString(str)) < 0) { + if ((def->onCrash = virDomainLifecycleActionTypeFromString(str)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected value %s for on_crash"), str); return -1; @@ -1467,7 +1467,7 @@ xenFormatEventActions(virConfPtr conf, virDomainDefPtr def) return -1; - if (!(lifecycle = virDomainLifecycleCrashTypeToString(def->onCrash))) { + if (!(lifecycle = virDomainLifecycleActionTypeToString(def->onCrash))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected lifecycle action %d"), def->onCrash); return -1; diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index fbb6480a30..26af770713 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1262,13 +1262,13 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_crash"); if (tmp != NULL) { - if ((def->onCrash = virDomainLifecycleCrashTypeFromString(tmp)) < 0) { + if ((def->onCrash = virDomainLifecycleActionTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown lifecycle type %s"), tmp); goto error; } } else { - def->onCrash = VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY; + def->onCrash = VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; } if (hvm) { @@ -2223,7 +2223,7 @@ xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def) } virBufferAsprintf(&buf, "(on_reboot '%s')", tmp); - if (!(tmp = virDomainLifecycleCrashTypeToString(def->onCrash))) { + if (!(tmp = virDomainLifecycleActionTypeToString(def->onCrash))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected lifecycle value %d"), def->onCrash); goto error;