mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

85dfdf
From 489a665a4715baa15fe77206030ab516f41ef961 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
a034fe
index 10bb83105..26b63c3b6 100644
90a56e
--- a/lib/qemu.c
90a56e
+++ b/lib/qemu.c
a034fe
@@ -988,10 +988,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,
a034fe
@@ -1016,12 +1012,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
-- 
a034fe
2.21.0
ffd6ed