mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-07 18:35:46 +00:00
virDomainWatchdogDef: Convert 'action' field to proper enum type
Convert the field and adjust the XML parser to use virXMLPropEnumDefault(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a6eadf00d2
commit
cc4bb25852
@ -12065,7 +12065,6 @@ virDomainWatchdogDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainWatchdogDef *def;
|
virDomainWatchdogDef *def;
|
||||||
g_autofree char *action = NULL;
|
|
||||||
|
|
||||||
def = g_new0(virDomainWatchdogDef, 1);
|
def = g_new0(virDomainWatchdogDef, 1);
|
||||||
|
|
||||||
@ -12076,16 +12075,12 @@ virDomainWatchdogDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
action = virXMLPropString(node, "action");
|
if (virXMLPropEnumDefault(node, "action",
|
||||||
if (action == NULL) {
|
virDomainWatchdogActionTypeFromString,
|
||||||
def->action = VIR_DOMAIN_WATCHDOG_ACTION_RESET;
|
VIR_XML_PROP_NONE,
|
||||||
} else {
|
&def->action,
|
||||||
def->action = virDomainWatchdogActionTypeFromString(action);
|
VIR_DOMAIN_WATCHDOG_ACTION_RESET) < 0) {
|
||||||
if (def->action < 0) {
|
goto error;
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("unknown watchdog action '%1$s'"), action);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags) < 0)
|
if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags) < 0)
|
||||||
|
@ -1760,7 +1760,7 @@ typedef enum {
|
|||||||
|
|
||||||
struct _virDomainWatchdogDef {
|
struct _virDomainWatchdogDef {
|
||||||
virDomainWatchdogModel model;
|
virDomainWatchdogModel model;
|
||||||
int action;
|
virDomainWatchdogAction action;
|
||||||
virDomainDeviceInfo info;
|
virDomainDeviceInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user