mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +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)
|
||||
{
|
||||
virDomainWatchdogDef *def;
|
||||
g_autofree char *action = NULL;
|
||||
|
||||
def = g_new0(virDomainWatchdogDef, 1);
|
||||
|
||||
@ -12076,16 +12075,12 @@ virDomainWatchdogDefParseXML(virDomainXMLOption *xmlopt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
action = virXMLPropString(node, "action");
|
||||
if (action == NULL) {
|
||||
def->action = VIR_DOMAIN_WATCHDOG_ACTION_RESET;
|
||||
} else {
|
||||
def->action = virDomainWatchdogActionTypeFromString(action);
|
||||
if (def->action < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown watchdog action '%1$s'"), action);
|
||||
goto error;
|
||||
}
|
||||
if (virXMLPropEnumDefault(node, "action",
|
||||
virDomainWatchdogActionTypeFromString,
|
||||
VIR_XML_PROP_NONE,
|
||||
&def->action,
|
||||
VIR_DOMAIN_WATCHDOG_ACTION_RESET) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags) < 0)
|
||||
|
@ -1760,7 +1760,7 @@ typedef enum {
|
||||
|
||||
struct _virDomainWatchdogDef {
|
||||
virDomainWatchdogModel model;
|
||||
int action;
|
||||
virDomainWatchdogAction action;
|
||||
virDomainDeviceInfo info;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user