if (!(ctxt->node = virXPathNode("./migrationSource", ctxt)))
return 0;
- if (!(migrSource = virStorageSourceNew()))
- return -1;
-
if (!(type = virXMLPropString(ctxt->node, "type"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing storage source type"));
return -1;
}
- if ((migrSource->type = virStorageTypeFromString(type)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown storage source type '%s'"), type);
- return -1;
- }
-
- if ((migrSource->format = virStorageFileFormatTypeFromString(format)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown storage source format '%s'"), format);
+ if (!(migrSource = virDomainStorageSourceParseBase(type, format, NULL)))
return -1;
- }
/* newer libvirt uses the <source> subelement instead of formatting the
* source directly into <migrationSource> */