]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: blockcopy: Report error on image format detection failure
authorPeter Krempa <pkrempa@redhat.com>
Fri, 29 Nov 2019 12:25:47 +0000 (13:25 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 2 Dec 2019 14:44:03 +0000 (15:44 +0100)
We tolerate image format detection during block copy in very specific
circumstances, but the code didn't error out on failure of the format
detection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index b5300241a8e6317346a98c091f56760ecf2e73b5..d72515f30fe8670a64cedf2df5151cd1822cb6d6 100644 (file)
@@ -18104,15 +18104,14 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
         if (!mirror_reuse) {
             mirror->format = disk->src->format;
         } else {
-            if (mirror_initialized &&
-                virStorageSourceIsLocalStorage(mirror)) {
-                /* If the user passed the REUSE_EXT flag, then either they
-                 * can also pass the RAW flag or use XML to tell us the format.
-                 * So if we get here, we assume it is safe for us to probe the
-                 * format from the file that we will be using.  */
-                mirror->format = virStorageFileProbeFormat(mirror->path, cfg->user,
-                                                           cfg->group);
-            } else {
+            /* If the user passed the REUSE_EXT flag, then either they
+             * can also pass the RAW flag or use XML to tell us the format.
+             * So if we get here, we assume it is safe for us to probe the
+             * format from the file that we will be using.  */
+            if (!mirror_initialized ||
+                !virStorageSourceIsLocalStorage(mirror) ||
+                (mirror->format = virStorageFileProbeFormat(mirror->path, cfg->user,
+                                                            cfg->group)) < 0) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("reused mirror destination format must be specified"));
                 goto endjob;