<define name="respartition">
<element name="resource">
- <element name="partition">
- <ref name="absFilePath"/>
- </element>
+ <optional>
+ <element name="partition">
+ <ref name="absFilePath"/>
+ </element>
+ </optional>
</element>
</define>
{
VIR_XPATH_NODE_AUTORESTORE(ctxt)
virDomainResourceDef *def = NULL;
+ char *partition = NULL;
ctxt->node = node;
- def = g_new0(virDomainResourceDef, 1);
+ partition = virXPathString("string(./partition)", ctxt);
- /* Find out what type of virtualization to use */
- if (!(def->partition = virXPathString("string(./partition)", ctxt))) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("missing resource partition attribute"));
- goto error;
- }
+ if (!partition)
+ return NULL;
- return def;
+ def = g_new0(virDomainResourceDef, 1);
+ def->partition = partition;
- error:
- virDomainResourceDefFree(def);
- return NULL;
+ return def;
}