mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From 1995428106fe0e14832e0b0d07e5b71740b193a4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 27 May 2015 10:03:00 -0400
Subject: [PATCH] RHEL 7: All qemu-kvm in RHEL 7 supports discard of qcow2
 (RHBZ#1225467).

For rationale behind this, see:

  https://bugzilla.redhat.com/show_bug.cgi?id=1225467#c2
---
 lib/qemu.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/lib/qemu.c b/lib/qemu.c
index d60692f0d..6bb54b70d 100644
--- a/lib/qemu.c
+++ b/lib/qemu.c
@@ -610,10 +610,6 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv,
    * discard option on -drive at all.
    */
   bool qemu15 = guestfs_int_version_ge (qemu_version, 1, 5, 0);
-  /* qemu >= 1.6.  This was the first version that supported unmap on
-   * qcow2 backing files.
-   */
-  bool qemu16 = guestfs_int_version_ge (qemu_version, 1, 6, 0);
 
   if (!qemu15)
     NOT_SUPPORTED (g, false,
@@ -638,12 +634,8 @@ guestfs_int_discard_possible (guestfs_h *g, struct drive *drv,
   }
   else if (STREQ (drv->src.format, "raw"))
     /* OK */ ;
-  else if (STREQ (drv->src.format, "qcow2")) {
-    if (!qemu16)
-      NOT_SUPPORTED (g, false,
-                     _("discard cannot be enabled on this drive: "
-                       "qemu < 1.6 cannot do discard on qcow2 files"));
-  }
+  else if (STREQ (drv->src.format, "qcow2"))
+    /* OK */ ;
   else {
     /* It's possible in future other formats will support discard, but
      * currently (qemu 1.7) none of them do.
-- 
2.13.4