We store the config of an iSCSI hostdev in a virStorageSource structure.
Parse the private data portion.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bda9375f13..ceaf73772d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8283,7 +8283,9 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
static int
virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
virDomainHostdevSubsysSCSIPtr def,
- xmlXPathContextPtr ctxt)
+ xmlXPathContextPtr ctxt,
+ unsigned int flags,
+ virDomainXMLOptionPtr xmlopt)
{
int auth_secret_usage = -1;
xmlNodePtr cur;
@@ -8348,13 +8350,27 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
}
cur = cur->next;
}
+
+ if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
+ xmlopt && xmlopt->privateData.storageParse) {
+ VIR_XPATH_NODE_AUTORESTORE(ctxt);
+
+ ctxt->node = sourcenode;
+
+ if ((ctxt->node = virXPathNode("./privateData", ctxt)) &&
+ xmlopt->privateData.storageParse(ctxt, iscsisrc->src) < 0)
+ return -1;
+ }
+
return 0;
}
static int
virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
virDomainHostdevSubsysSCSIPtr scsisrc,
- xmlXPathContextPtr ctxt)
+ xmlXPathContextPtr ctxt,
+ unsigned int flags,
+ virDomainXMLOptionPtr xmlopt)
{
g_autofree char *protocol = NULL;
@@ -8370,7 +8386,8 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
}
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
- return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc, ctxt);
+ return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc, ctxt,
+ flags, xmlopt);
return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
}
@@ -8461,7 +8478,8 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
xmlXPathContextPtr ctxt,
const char *type,
virDomainHostdevDefPtr def,
- unsigned int flags)
+ unsigned int flags,
+ virDomainXMLOptionPtr xmlopt)
{
xmlNodePtr sourcenode;
int backend;
@@ -8633,7 +8651,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
- if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc, ctxt) < 0)
+ if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc, ctxt, flags,
xmlopt) < 0)
return -1;
break;
@@ -11645,7 +11663,8 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
virDomainNetDefPtr parent,
virDomainActualNetDefPtr *def,
- unsigned int flags)
+ unsigned int flags,
+ virDomainXMLOptionPtr xmlopt)
{
virDomainActualNetDefPtr actual = NULL;
int ret = -1;
@@ -11750,7 +11769,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
addrtype = g_strdup("usb");
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
- hostdev, flags) < 0) {
+ hostdev, flags, xmlopt) < 0) {
goto error;
}
} else if (actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
@@ -12124,7 +12143,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
virXMLNodeNameEqual(cur, "actual")) {
if (virDomainActualNetDefParseXML(cur, ctxt, def,
- &actual, flags) < 0) {
+ &actual, flags, xmlopt) < 0) {
goto error;
}
} else if (virXMLNodeNameEqual(cur, "bandwidth")) {
@@ -12388,7 +12407,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
addrtype = g_strdup("usb");
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
- hostdev, flags) < 0) {
+ hostdev, flags, xmlopt) < 0) {
goto error;
}
break;
@@ -16140,7 +16159,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
switch (def->mode) {
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
/* parse managed/mode/type, and the <source> element */
- if (virDomainHostdevDefParseXMLSubsys(node, ctxt, type, def, flags) < 0)
+ if (virDomainHostdevDefParseXMLSubsys(node, ctxt, type, def, flags, xmlopt) <
0)
goto error;
break;
case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
--
2.26.2