mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
conf: Add XML format/parse methods for VIR_STORAGE_NET_PROTOCOL_NFS
Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
943871f971
commit
86e26645ee
@ -6888,6 +6888,23 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
virDomainStorageNetworkParseNFS(xmlNodePtr node,
|
||||||
|
xmlXPathContextPtr ctxt,
|
||||||
|
virStorageSourcePtr src)
|
||||||
|
{
|
||||||
|
xmlNodePtr nfsIdentityNode = NULL;
|
||||||
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
|
|
||||||
|
ctxt->node = node;
|
||||||
|
|
||||||
|
if ((nfsIdentityNode = virXPathNode("./identity", ctxt))) {
|
||||||
|
src->nfs_user = virXMLPropString(nfsIdentityNode, "user");
|
||||||
|
src->nfs_group = virXMLPropString(nfsIdentityNode, "group");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
|
virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
|
||||||
xmlXPathContextPtr ctxt,
|
xmlXPathContextPtr ctxt,
|
||||||
@ -8250,6 +8267,9 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
|
|||||||
if (virDomainStorageNetworkParseHosts(node, ctxt, &src->hosts, &src->nhosts) < 0)
|
if (virDomainStorageNetworkParseHosts(node, ctxt, &src->hosts, &src->nhosts) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_NFS)
|
||||||
|
virDomainStorageNetworkParseNFS(node, ctxt, src);
|
||||||
|
|
||||||
virStorageSourceNetworkAssignDefaultPorts(src);
|
virStorageSourceNetworkAssignDefaultPorts(src);
|
||||||
|
|
||||||
virStorageSourceInitiatorParseXML(ctxt, &src->initiator);
|
virStorageSourceInitiatorParseXML(ctxt, &src->initiator);
|
||||||
@ -23851,6 +23871,17 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
|
|||||||
virBufferAddLit(childBuf, "/>\n");
|
virBufferAddLit(childBuf, "/>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_NFS &&
|
||||||
|
(src->nfs_user || src->nfs_group)) {
|
||||||
|
virBufferAddLit(childBuf, "<identity");
|
||||||
|
|
||||||
|
virBufferEscapeString(childBuf, " user='%s'", src->nfs_user);
|
||||||
|
virBufferEscapeString(childBuf, " group='%s'", src->nfs_group);
|
||||||
|
|
||||||
|
virBufferAddLit(childBuf, "/>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virBufferEscapeString(childBuf, "<snapshot name='%s'/>\n", src->snapshot);
|
virBufferEscapeString(childBuf, "<snapshot name='%s'/>\n", src->snapshot);
|
||||||
virBufferEscapeString(childBuf, "<config file='%s'/>\n", src->configFile);
|
virBufferEscapeString(childBuf, "<config file='%s'/>\n", src->configFile);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user