mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virDomainDeviceInfoParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
ad1d37876d
commit
dfff3db776
@ -6629,15 +6629,13 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virDomainDeviceInfo *info,
|
virDomainDeviceInfo *info,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
xmlNodePtr acpi = NULL;
|
||||||
xmlNodePtr address = NULL;
|
xmlNodePtr address = NULL;
|
||||||
xmlNodePtr master = NULL;
|
xmlNodePtr master = NULL;
|
||||||
xmlNodePtr boot = NULL;
|
xmlNodePtr boot = NULL;
|
||||||
xmlNodePtr rom = NULL;
|
xmlNodePtr rom = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autofree char *romenabled = NULL;
|
|
||||||
g_autofree char *rombar = NULL;
|
|
||||||
g_autofree char *aliasStr = NULL;
|
g_autofree char *aliasStr = NULL;
|
||||||
g_autofree char *acpiIndex = NULL;
|
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
|
|
||||||
virDomainDeviceInfoClear(info);
|
virDomainDeviceInfoClear(info);
|
||||||
@ -6664,24 +6662,14 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
if ((flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) &&
|
if ((flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) &&
|
||||||
(rom = virXPathNode("./rom", ctxt))) {
|
(rom = virXPathNode("./rom", ctxt))) {
|
||||||
if ((romenabled = virXPathString("string(./rom/@enabled)", ctxt))) {
|
if (virXMLPropTristateBool(rom, "enabled", VIR_XML_PROP_NONE,
|
||||||
int value;
|
&info->romenabled) < 0)
|
||||||
if ((value = virTristateBoolTypeFromString(romenabled)) <= 0) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("unknown rom enabled value '%s'"), romenabled);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
info->romenabled = value;
|
if (virXMLPropTristateSwitch(rom, "bar", VIR_XML_PROP_NONE,
|
||||||
}
|
&info->rombar) < 0)
|
||||||
if ((rombar = virXPathString("string(./rom/@bar)", ctxt))) {
|
|
||||||
int value;
|
|
||||||
if ((value = virTristateSwitchTypeFromString(rombar)) <= 0) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
_("unknown rom bar value '%s'"), rombar);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
info->rombar = value;
|
|
||||||
}
|
|
||||||
info->romfile = virXMLPropString(rom, "file");
|
info->romfile = virXMLPropString(rom, "file");
|
||||||
|
|
||||||
if (info->romenabled == VIR_TRISTATE_BOOL_NO &&
|
if (info->romenabled == VIR_TRISTATE_BOOL_NO &&
|
||||||
@ -6692,11 +6680,9 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xmlopt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpiIndex = virXPathString("string(./acpi/@index)", ctxt);
|
if ((acpi = virXPathNode("./acpi", ctxt))) {
|
||||||
if (acpiIndex &&
|
if (virXMLPropUInt(acpi, "index", 10, VIR_XML_PROP_NONE,
|
||||||
virStrToLong_ui(acpiIndex, NULL, 10, &info->acpiIndex) < 0) {
|
&info->acpiIndex) < 0)
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
|
||||||
_("Cannot parse ACPI index value '%s'"), acpiIndex);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user