mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

a30de4
From ef6ad315f02830f04a467cd32be09e2b25ce3824 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
a30de4
index a5278129c..c9debe937 100644
90a56e
--- a/lib/qemu.c
90a56e
+++ b/lib/qemu.c
a30de4
@@ -963,10 +963,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,
a30de4
@@ -991,12 +987,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
-- 
a30de4
2.14.3
ffd6ed