mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virStorageAdapterParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
058d4ed47e
commit
99037fb2b9
@ -170,18 +170,16 @@ virStorageAdapterParseXML(virStorageAdapter *adapter,
|
||||
{
|
||||
int type;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
g_autofree char *adapter_type = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
if ((adapter_type = virXMLPropString(node, "type"))) {
|
||||
if ((type = virStorageAdapterTypeFromString(adapter_type)) <= 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unknown pool adapter type '%s'"),
|
||||
adapter_type);
|
||||
if ((type = virXMLPropEnum(node, "type",
|
||||
virStorageAdapterTypeFromString,
|
||||
VIR_XML_PROP_NONZERO, &adapter->type)) < 0)
|
||||
return -1;
|
||||
}
|
||||
adapter->type = type;
|
||||
|
||||
if (type == 0)
|
||||
return virStorageAdapterParseXMLLegacy(node, ctxt, adapter);
|
||||
|
||||
if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_FC_HOST) &&
|
||||
(virStorageAdapterParseXMLFCHost(node, &adapter->data.fchost)) < 0)
|
||||
@ -191,10 +189,6 @@ virStorageAdapterParseXML(virStorageAdapter *adapter,
|
||||
(virStorageAdapterParseXMLSCSIHost(node, ctxt,
|
||||
&adapter->data.scsi_host)) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
if (virStorageAdapterParseXMLLegacy(node, ctxt, adapter) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user