There is no need to have two different enums where one has the same
values as the other one with some additions.
Currently for on_poweroff and on_reboot we allow only subset of actions
that are allowed for on_crash. This was covered in parse time using
two different enums. Now to make sure that we don't allow setting
actions that are not supported we need to check it while validating
domain config.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 69 +++++++++++++++++++++++++++++++++++++------
src/conf/domain_conf.h | 14 ++-------
src/libvirt_private.syms | 2 --
src/libxl/libxl_conf.c | 33 +++------------------
src/libxl/libxl_domain.c | 20 ++++++++-----
src/lxc/lxc_native.c | 2 +-
src/qemu/qemu_command.c | 4 +--
src/qemu/qemu_driver.c | 10 +++----
src/qemu/qemu_parse_command.c | 2 +-
src/vmx/vmx.c | 2 +-
src/vz/vz_sdk.c | 4 +--
src/xenapi/xenapi_utils.c | 30 +++++++++----------
src/xenapi/xenapi_utils.h | 4 +--
src/xenconfig/xen_common.c | 4 +--
src/xenconfig/xen_sxpr.c | 6 ++--
15 files changed, 112 insertions(+), 94 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e9d7f8911e..f69bcc2530 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -217,12 +217,6 @@ 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",
"preserve",
"coredump-destroy",
"coredump-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;
}
@@ -18602,8 +18653,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",
@@ -25875,7 +25926,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,22 +1804,13 @@ 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,
VIR_DOMAIN_LOCK_FAILURE_RESTART,
@@ -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 1fef62a0cb..4cd328eded 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -402,8 +402,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 174385324c..6b6de08e47 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6496,8 +6496,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 d9abe40f29..f7d713ab59 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 659db96d10..4ef28cdd55 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1834,7 +1834,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 c4ffbde9a4..28d30f248d 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 d26026fed2..0946804420 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1267,13 +1267,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) {
@@ -2228,7 +2228,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;
--
2.13.6