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

ffd6ed
From 2a9848fa03b3c5ecefdb3f09b6c458f83c4d233d 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
---
ffd6ed
 src/launch-direct.c | 12 ++----------
ffd6ed
 1 file changed, 2 insertions(+), 10 deletions(-)
ffd6ed
ffd6ed
diff --git a/src/launch-direct.c b/src/launch-direct.c
ffd6ed
index fa3bb7a..4dde5df 100644
ffd6ed
--- a/src/launch-direct.c
ffd6ed
+++ b/src/launch-direct.c
ffd6ed
@@ -1431,10 +1431,6 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv,
ffd6ed
    * discard option on -drive at all.
ffd6ed
    */
ffd6ed
   bool qemu15 = qemu_version >= 1005000;
ffd6ed
-  /* qemu >= 1.6.  This was the first version that supported unmap on
ffd6ed
-   * qcow2 backing files.
ffd6ed
-   */
ffd6ed
-  bool qemu16 = qemu_version >= 1006000;
ffd6ed
 
ffd6ed
   if (!qemu15)
ffd6ed
     NOT_SUPPORTED (g, false,
ffd6ed
@@ -1459,12 +1455,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
-- 
ffd6ed
1.8.3.1
ffd6ed