mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
virDomainTimerDef: Convert 'tickpolicy' field to proper enum type
Convert the field, adjust the XML parser to use virXMLPropEnum and add the VIR_DOMAIN_TIMER_TICKPOLICY_LAST enum case to all appropriate 'switch' statements. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7fc2c87200
commit
7fb8adc7cd
@ -10546,7 +10546,6 @@ virDomainTimerDefParseXML(xmlNodePtr node,
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
xmlNodePtr catchup;
|
||||
int ret;
|
||||
g_autofree char *tickpolicy = NULL;
|
||||
g_autofree char *track = NULL;
|
||||
g_autofree char *mode = NULL;
|
||||
|
||||
@ -10561,14 +10560,9 @@ virDomainTimerDefParseXML(xmlNodePtr node,
|
||||
&def->present) < 0)
|
||||
return NULL;
|
||||
|
||||
tickpolicy = virXMLPropString(node, "tickpolicy");
|
||||
if (tickpolicy != NULL) {
|
||||
if ((def->tickpolicy = virDomainTimerTickpolicyTypeFromString(tickpolicy)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown timer tickpolicy '%s'"), tickpolicy);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (virXMLPropEnum(node, "tickpolicy", virDomainTimerTickpolicyTypeFromString,
|
||||
VIR_XML_PROP_NONZERO, &def->tickpolicy) < 0)
|
||||
return NULL;
|
||||
|
||||
track = virXMLPropString(node, "track");
|
||||
if (track != NULL) {
|
||||
|
@ -2474,7 +2474,7 @@ struct _virDomainTimerCatchupDef {
|
||||
struct _virDomainTimerDef {
|
||||
virDomainTimerNameType name;
|
||||
virTristateBool present;
|
||||
int tickpolicy; /* enum virDomainTimerTickpolicyType */
|
||||
virDomainTimerTickpolicyType tickpolicy;
|
||||
|
||||
virDomainTimerCatchupDef catchup;
|
||||
|
||||
|
@ -5747,6 +5747,8 @@ qemuBuildClockArgStr(virDomainClockDef *def)
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE:
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD:
|
||||
return NULL;
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_LAST:
|
||||
break;
|
||||
}
|
||||
break; /* no need to check other timers - there is only one rtc */
|
||||
}
|
||||
@ -5818,6 +5820,8 @@ qemuBuildClockCommandLine(virCommand *cmd,
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE:
|
||||
/* no way to support this mode for pit in qemu */
|
||||
return -1;
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_LAST:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6201,6 +6205,7 @@ qemuBuildCpuCommandLine(virCommand *cmd,
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_NONE:
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP:
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE:
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_LAST:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -572,6 +572,8 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
|
||||
virDomainTimerTickpolicyTypeToString(
|
||||
timer->tickpolicy));
|
||||
return -1;
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_LAST:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -598,6 +600,8 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
|
||||
virDomainTimerTickpolicyTypeToString(
|
||||
timer->tickpolicy));
|
||||
return -1;
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_LAST:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -650,6 +654,8 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
|
||||
virDomainTimerNameTypeToString(timer->name),
|
||||
virDomainTimerTickpolicyTypeToString(timer->tickpolicy));
|
||||
return -1;
|
||||
case VIR_DOMAIN_TIMER_TICKPOLICY_LAST:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user