render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c1c534
From 9911807f7cf94ab328916fd9f00f20cc09a6455a Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <9911807f7cf94ab328916fd9f00f20cc09a6455a@dist-git>
c1c534
From: Peter Krempa <pkrempa@redhat.com>
c1c534
Date: Thu, 23 Nov 2017 19:02:21 +0100
c1c534
Subject: [PATCH] qemu: Disallow pivot of shared disks to unsupported storage
c1c534
c1c534
Pivoting to a unsupported storage type might break the assumption that
c1c534
shared disks will not corrupt metadata.
c1c534
c1c534
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1511480
c1c534
(cherry picked from commit 2b41c86294786c07f53afa633fe3dce703debc3c)
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_driver.c | 10 ++++++++++
c1c534
 1 file changed, 10 insertions(+)
c1c534
c1c534
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
c1c534
index 620028fe07..d0d29747cf 100644
c1c534
--- a/src/qemu/qemu_driver.c
c1c534
+++ b/src/qemu/qemu_driver.c
c1c534
@@ -16509,6 +16509,16 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
c1c534
         goto cleanup;
c1c534
     }
c1c534
 
c1c534
+    /* When pivoting to a shareable disk we need to make sure that the disk can
c1c534
+     * be safely shared, since block copy might have changed the format. */
c1c534
+    if (disk->src->shared && !disk->src->readonly &&
c1c534
+        !qemuBlockStorageSourceSupportsConcurrentAccess(disk->mirror)) {
c1c534
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
c1c534
+                       _("can't pivot a shared disk to a storage volume not "
c1c534
+                         "supporting sharing"));
c1c534
+        goto cleanup;
c1c534
+    }
c1c534
+
c1c534
     /* For active commit, the mirror is part of the already labeled
c1c534
      * chain.  For blockcopy, we previously labeled only the top-level
c1c534
      * image; but if the user is reusing an external image that
c1c534
-- 
c1c534
2.15.0
c1c534