render / rpms / libvirt

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