1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

conf: merge virDomainLifecycleCrashAction with virDomainLifecycleAction

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.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2017-10-10 14:51:38 +02:00
parent 1ccf35b4f2
commit 8c85b1ed4a
15 changed files with 112 additions and 94 deletions

View File

@ -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,

View File

@ -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)

View File

@ -403,8 +403,6 @@ virDomainLeaseRemove;
virDomainLeaseRemoveAt;
virDomainLifecycleActionTypeFromString;
virDomainLifecycleActionTypeToString;
virDomainLifecycleCrashTypeFromString;
virDomainLifecycleCrashTypeToString;
virDomainLoaderDefFree;
virDomainLoaderTypeFromString;
virDomainLoaderTypeToString;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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");
}

View File

@ -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:

View File

@ -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)

View File

@ -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;

View File

@ -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 "

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;