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

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