mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virDomainSchedulerParseCommonAttrs: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
124357c17a
commit
a6a8d9b09f
@ -17870,37 +17870,15 @@ virDomainSchedulerParseCommonAttrs(xmlNodePtr node,
|
|||||||
virProcessSchedPolicy *policy,
|
virProcessSchedPolicy *policy,
|
||||||
int *priority)
|
int *priority)
|
||||||
{
|
{
|
||||||
int pol = 0;
|
if (virXMLPropEnum(node, "scheduler", virProcessSchedPolicyTypeFromString,
|
||||||
g_autofree char *tmp = NULL;
|
VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
|
||||||
|
policy) < 0)
|
||||||
if (!(tmp = virXMLPropString(node, "scheduler"))) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
||||||
_("Missing scheduler attribute"));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if ((pol = virProcessSchedPolicyTypeFromString(tmp)) <= 0) {
|
if (*policy == VIR_PROC_POLICY_FIFO || *policy == VIR_PROC_POLICY_RR) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
if (virXMLPropInt(node, "priority", 10, VIR_XML_PROP_REQUIRED,
|
||||||
_("Invalid scheduler attribute: '%s'"), tmp);
|
priority) < 0)
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
*policy = pol;
|
|
||||||
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
|
|
||||||
if (pol == VIR_PROC_POLICY_FIFO ||
|
|
||||||
pol == VIR_PROC_POLICY_RR) {
|
|
||||||
if (!(tmp = virXMLPropString(node, "priority"))) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
||||||
_("Missing scheduler priority"));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (virStrToLong_i(tmp, NULL, 10, priority) < 0) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
||||||
_("Invalid value for element priority"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user