mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 14:03:49 +03:00
virDomainHostdevSubsysSCSIiSCSIDefParseXML: Parse private data of virStorageSource
We store the config of an iSCSI hostdev in a virStorageSource structure. Parse the private data portion. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4f708a15b6
commit
bb78cf0046
@ -8290,7 +8290,9 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
|
|||||||
static int
|
static int
|
||||||
virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
|
virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
|
||||||
virDomainHostdevSubsysSCSIPtr def,
|
virDomainHostdevSubsysSCSIPtr def,
|
||||||
xmlXPathContextPtr ctxt)
|
xmlXPathContextPtr ctxt,
|
||||||
|
unsigned int flags,
|
||||||
|
virDomainXMLOptionPtr xmlopt)
|
||||||
{
|
{
|
||||||
int auth_secret_usage = -1;
|
int auth_secret_usage = -1;
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
@ -8355,13 +8357,27 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
|
|||||||
}
|
}
|
||||||
cur = cur->next;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
|
virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
|
||||||
virDomainHostdevSubsysSCSIPtr scsisrc,
|
virDomainHostdevSubsysSCSIPtr scsisrc,
|
||||||
xmlXPathContextPtr ctxt)
|
xmlXPathContextPtr ctxt,
|
||||||
|
unsigned int flags,
|
||||||
|
virDomainXMLOptionPtr xmlopt)
|
||||||
{
|
{
|
||||||
g_autofree char *protocol = NULL;
|
g_autofree char *protocol = NULL;
|
||||||
|
|
||||||
@ -8377,7 +8393,8 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
|
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);
|
return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
|
||||||
}
|
}
|
||||||
@ -8468,7 +8485,8 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
|||||||
xmlXPathContextPtr ctxt,
|
xmlXPathContextPtr ctxt,
|
||||||
const char *type,
|
const char *type,
|
||||||
virDomainHostdevDefPtr def,
|
virDomainHostdevDefPtr def,
|
||||||
unsigned int flags)
|
unsigned int flags,
|
||||||
|
virDomainXMLOptionPtr xmlopt)
|
||||||
{
|
{
|
||||||
xmlNodePtr sourcenode;
|
xmlNodePtr sourcenode;
|
||||||
int backend;
|
int backend;
|
||||||
@ -8640,7 +8658,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
||||||
if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc, ctxt) < 0)
|
if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc, ctxt, flags, xmlopt) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -11652,7 +11670,8 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
|
|||||||
xmlXPathContextPtr ctxt,
|
xmlXPathContextPtr ctxt,
|
||||||
virDomainNetDefPtr parent,
|
virDomainNetDefPtr parent,
|
||||||
virDomainActualNetDefPtr *def,
|
virDomainActualNetDefPtr *def,
|
||||||
unsigned int flags)
|
unsigned int flags,
|
||||||
|
virDomainXMLOptionPtr xmlopt)
|
||||||
{
|
{
|
||||||
virDomainActualNetDefPtr actual = NULL;
|
virDomainActualNetDefPtr actual = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -11757,7 +11776,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
|
|||||||
addrtype = g_strdup("usb");
|
addrtype = g_strdup("usb");
|
||||||
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
||||||
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
|
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
|
||||||
hostdev, flags) < 0) {
|
hostdev, flags, xmlopt) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
} else if (actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
||||||
@ -12133,7 +12152,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
|
def->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
|
||||||
virXMLNodeNameEqual(cur, "actual")) {
|
virXMLNodeNameEqual(cur, "actual")) {
|
||||||
if (virDomainActualNetDefParseXML(cur, ctxt, def,
|
if (virDomainActualNetDefParseXML(cur, ctxt, def,
|
||||||
&actual, flags) < 0) {
|
&actual, flags, xmlopt) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (virXMLNodeNameEqual(cur, "bandwidth")) {
|
} else if (virXMLNodeNameEqual(cur, "bandwidth")) {
|
||||||
@ -12409,7 +12428,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
addrtype = g_strdup("usb");
|
addrtype = g_strdup("usb");
|
||||||
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
||||||
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
|
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
|
||||||
hostdev, flags) < 0) {
|
hostdev, flags, xmlopt) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -16161,7 +16180,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
switch (def->mode) {
|
switch (def->mode) {
|
||||||
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
|
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
|
||||||
/* parse managed/mode/type, and the <source> element */
|
/* 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;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
|
case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user