]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Use virDomainStorageSourceParseBase in qemuDomainObjPrivateXMLParseJobNBDSource
authorPeter Krempa <pkrempa@redhat.com>
Wed, 20 Mar 2019 16:16:21 +0000 (17:16 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Apr 2019 09:58:09 +0000 (11:58 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c

index 8e1918b755ce32bfc5fbbdd283126e3d602fcdd6..a528cf51f0d4d372041365ca673539e3026bebac 100644 (file)
@@ -2724,9 +2724,6 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
     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"));
@@ -2739,17 +2736,8 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
         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> */