mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0029-RHEL-7-All-qemu-kvm-in-RHEL-7-supports-discard-of-qc.patch

491457
From e652aa29e63a25cb99fcf290f4a2ff2bc121f09a Mon Sep 17 00:00:00 2001
4ebc84
From: "Richard W.M. Jones" <rjones@redhat.com>
4ebc84
Date: Wed, 27 May 2015 10:03:00 -0400
4ebc84
Subject: [PATCH] RHEL 7: All qemu-kvm in RHEL 7 supports discard of qcow2
4ebc84
 (RHBZ#1225467).
4ebc84
4ebc84
For rationale behind this, see:
4ebc84
4ebc84
  https://bugzilla.redhat.com/show_bug.cgi?id=1225467#c2
4ebc84
---
4ebc84
 lib/qemu.c | 12 ++----------
4ebc84
 1 file changed, 2 insertions(+), 10 deletions(-)
4ebc84
4ebc84
diff --git a/lib/qemu.c b/lib/qemu.c
4ebc84
index 10bb83105..26b63c3b6 100644
4ebc84
--- a/lib/qemu.c
4ebc84
+++ b/lib/qemu.c
4ebc84
@@ -988,10 +988,6 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv,
4ebc84
    * discard option on -drive at all.
4ebc84
    */
4ebc84
   bool qemu15 = guestfs_int_version_ge (qemu_version, 1, 5, 0);
4ebc84
-  /* qemu >= 1.6.  This was the first version that supported unmap on
4ebc84
-   * qcow2 backing files.
4ebc84
-   */
4ebc84
-  bool qemu16 = guestfs_int_version_ge (qemu_version, 1, 6, 0);
4ebc84
 
4ebc84
   if (!qemu15)
4ebc84
     NOT_SUPPORTED (g, false,
4ebc84
@@ -1016,12 +1012,8 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv,
4ebc84
   }
4ebc84
   else if (STREQ (drv->src.format, "raw"))
4ebc84
     /* OK */ ;
4ebc84
-  else if (STREQ (drv->src.format, "qcow2")) {
4ebc84
-    if (!qemu16)
4ebc84
-      NOT_SUPPORTED (g, false,
4ebc84
-                     _("discard cannot be enabled on this drive: "
4ebc84
-                       "qemu < 1.6 cannot do discard on qcow2 files"));
4ebc84
-  }
4ebc84
+  else if (STREQ (drv->src.format, "qcow2"))
4ebc84
+    /* OK */ ;
4ebc84
   else {
4ebc84
     /* It's possible in future other formats will support discard, but
4ebc84
      * currently (qemu 1.7) none of them do.
4ebc84
-- 
4ebc84
2.21.0
4ebc84