mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-23 11:52:20 +00:00
conf: domain: Introduce virDomainDiskDefParseSource
Add a helper function which will parse the source portion of a <disk>. The idea is to replace *virDomainDiskDefParse with VIR_DOMAIN_DEF_PARSE_DISK_SOURCE with the new helper in the future. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
5c56538937
commit
fb0238414e
@ -9704,6 +9704,21 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
|
||||
}
|
||||
|
||||
|
||||
static virStorageSource *
|
||||
virDomainDiskDefParseSourceXML(virDomainXMLOption *xmlopt,
|
||||
xmlNodePtr node,
|
||||
xmlXPathContextPtr ctxt,
|
||||
unsigned int flags)
|
||||
{
|
||||
g_autoptr(virDomainDiskDef) diskdef = NULL;
|
||||
|
||||
if (!(diskdef = virDomainDiskDefParseXML(xmlopt, node, ctxt,
|
||||
flags | VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)))
|
||||
return NULL;
|
||||
|
||||
return g_steal_pointer(&diskdef->src);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainParseMemory:
|
||||
@ -16445,6 +16460,21 @@ virDomainDiskDefParse(const char *xmlStr,
|
||||
}
|
||||
|
||||
|
||||
virStorageSource *
|
||||
virDomainDiskDefParseSource(const char *xmlStr,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags)
|
||||
{
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
|
||||
if (!(xml = virXMLParseStringCtxtRoot(xmlStr, _("(disk_definition)"), "disk", &ctxt)))
|
||||
return NULL;
|
||||
|
||||
return virDomainDiskDefParseSourceXML(xmlopt, ctxt->node, ctxt, flags);
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
virDomainChrTargetTypeToString(int deviceType,
|
||||
int targetType)
|
||||
|
@ -3406,6 +3406,9 @@ virDomainDeviceDef *virDomainDeviceDefParse(const char *xmlStr,
|
||||
virDomainDiskDef *virDomainDiskDefParse(const char *xmlStr,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags);
|
||||
virStorageSource *virDomainDiskDefParseSource(const char *xmlStr,
|
||||
virDomainXMLOption *xmlopt,
|
||||
unsigned int flags);
|
||||
virDomainDef *virDomainDefParseString(const char *xmlStr,
|
||||
virDomainXMLOption *xmlopt,
|
||||
void *parseOpaque,
|
||||
|
@ -371,6 +371,7 @@ virDomainDiskDefCheckDuplicateInfo;
|
||||
virDomainDiskDefFree;
|
||||
virDomainDiskDefNew;
|
||||
virDomainDiskDefParse;
|
||||
virDomainDiskDefParseSource;
|
||||
virDomainDiskDetectZeroesTypeFromString;
|
||||
virDomainDiskDetectZeroesTypeToString;
|
||||
virDomainDiskDeviceTypeToString;
|
||||
|
Loading…
x
Reference in New Issue
Block a user