This guest NUMA specification is currently available only for QEMU/KVM.
</p>
- <h3><a name="elementsLifecycle">Lifecycle control</a></h3>
+ <h3><a name="elementsEvents">Events configuration</a></h3>
<p>
It is sometimes necessary to override the default actions taken
- when a guest OS triggers a lifecycle operation. The following
- collections of elements allow the actions to be specified. A
- common use case is to force a reboot to be treated as a poweroff
- when doing the initial OS installation. This allows the VM to be
- re-configured for the first post-install bootup.
+ on various events.
</p>
<pre>
<on_crash>restart</on_crash>
...</pre>
+ <p>
+ The following collections of elements allow the actions to be
+ specified when a guest OS triggers a lifecycle operation. A
+ common use case is to force a reboot to be treated as a poweroff
+ when doing the initial OS installation. This allows the VM to be
+ re-configured for the first post-install bootup.
+ </p>
<dl>
<dt><code>on_poweroff</code></dt>
<dd>The content of this element specifies the action to take when
return NULL;
}
-static int virDomainLifecycleParseXML(xmlXPathContextPtr ctxt,
- const char *xpath,
- int *val,
- int defaultVal,
- virLifecycleFromStringFunc convFunc)
+static int virDomainEventActionParseXML(xmlXPathContextPtr ctxt,
+ const char *name,
+ const char *xpath,
+ int *val,
+ int defaultVal,
+ virEventActionFromStringFunc convFunc)
{
char *tmp = virXPathString(xpath, ctxt);
if (tmp == NULL) {
*val = convFunc(tmp);
if (*val < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unknown lifecycle action %s"), tmp);
+ _("unknown %s action: %s"), name, tmp);
VIR_FREE(tmp);
return -1;
}
VIR_FREE(nodes);
}
- if (virDomainLifecycleParseXML(ctxt, "string(./on_reboot[1])",
- &def->onReboot, VIR_DOMAIN_LIFECYCLE_RESTART,
- virDomainLifecycleTypeFromString) < 0)
+ if (virDomainEventActionParseXML(ctxt, "on_reboot",
+ "string(./on_reboot[1])",
+ &def->onReboot,
+ VIR_DOMAIN_LIFECYCLE_RESTART,
+ virDomainLifecycleTypeFromString) < 0)
goto error;
- if (virDomainLifecycleParseXML(ctxt, "string(./on_poweroff[1])",
- &def->onPoweroff, VIR_DOMAIN_LIFECYCLE_DESTROY,
- virDomainLifecycleTypeFromString) < 0)
+ if (virDomainEventActionParseXML(ctxt, "on_poweroff",
+ "string(./on_poweroff[1])",
+ &def->onPoweroff,
+ VIR_DOMAIN_LIFECYCLE_DESTROY,
+ virDomainLifecycleTypeFromString) < 0)
goto error;
- if (virDomainLifecycleParseXML(ctxt, "string(./on_crash[1])",
- &def->onCrash,
- VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY,
- virDomainLifecycleCrashTypeFromString) < 0)
+ if (virDomainEventActionParseXML(ctxt, "on_crash",
+ "string(./on_crash[1])",
+ &def->onCrash,
+ VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY,
+ virDomainLifecycleCrashTypeFromString) < 0)
goto error;
if (virDomainPMStateParseXML(ctxt,
}
static int
-virDomainLifecycleDefFormat(virBufferPtr buf,
- int type,
- const char *name,
- virLifecycleToStringFunc convFunc)
+virDomainEventActionDefFormat(virBufferPtr buf,
+ int type,
+ const char *name,
+ virEventActionToStringFunc convFunc)
{
const char *typeStr = convFunc(type);
if (!typeStr) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected lifecycle type %d"), type);
+ _("unexpected %s action: %d"), name, type);
return -1;
}
virBufferAddLit(buf, " </clock>\n");
}
- if (virDomainLifecycleDefFormat(buf, def->onPoweroff,
- "on_poweroff",
- virDomainLifecycleTypeToString) < 0)
+ if (virDomainEventActionDefFormat(buf, def->onPoweroff,
+ "on_poweroff",
+ virDomainLifecycleTypeToString) < 0)
goto cleanup;
- if (virDomainLifecycleDefFormat(buf, def->onReboot,
- "on_reboot",
- virDomainLifecycleTypeToString) < 0)
+ if (virDomainEventActionDefFormat(buf, def->onReboot,
+ "on_reboot",
+ virDomainLifecycleTypeToString) < 0)
goto cleanup;
- if (virDomainLifecycleDefFormat(buf, def->onCrash,
- "on_crash",
- virDomainLifecycleCrashTypeToString) < 0)
+ if (virDomainEventActionDefFormat(buf, def->onCrash,
+ "on_crash",
+ virDomainLifecycleCrashTypeToString) < 0)
goto cleanup;
if (def->pm.s3 || def->pm.s4) {