mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0151-v2v-Only-emit-fstrim-warning-when-debugging-RHBZ-116.patch

ffd6ed
From f2d1b07e1a04bb587657813e837c9040b0183a4a Mon Sep 17 00:00:00 2001
ffd6ed
From: "Richard W.M. Jones" <rjones@redhat.com>
ffd6ed
Date: Mon, 20 Apr 2015 13:12:08 +0100
ffd6ed
Subject: [PATCH] v2v: Only emit fstrim warning when debugging (RHBZ#1168144).
ffd6ed
ffd6ed
fstrim is an optimization.  If it fails, it's not fatal (although
ffd6ed
virt-v2v will run a lot more slowly).
ffd6ed
ffd6ed
We also expect that it will fail for non-aligned NTFS partitions found
ffd6ed
on old versions of Windows, and in that case there's nothing that can
ffd6ed
be done about it.
ffd6ed
ffd6ed
Therefore only emit the warning when we are debugging.
ffd6ed
ffd6ed
(cherry picked from commit 0576fdd0b6bafaeaa3d69bf6fc6fef0d0a1254d1)
ffd6ed
---
ffd6ed
 v2v/v2v.ml | 7 ++++++-
ffd6ed
 1 file changed, 6 insertions(+), 1 deletion(-)
ffd6ed
ffd6ed
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
ffd6ed
index 8639482..1ab6a24 100644
ffd6ed
--- a/v2v/v2v.ml
ffd6ed
+++ b/v2v/v2v.ml
ffd6ed
@@ -621,7 +621,12 @@ and do_fstrim ~verbose g no_trim inspect =
ffd6ed
       let mounted = try g#mount dev "/"; true with G.Error _ -> false in
ffd6ed
       if mounted then (
ffd6ed
         try g#fstrim "/"
ffd6ed
-        with G.Error msg -> warning ~prog (f_"%s (ignored)") msg
ffd6ed
+        with G.Error msg ->
ffd6ed
+          (* Only emit this warning when debugging, because otherwise
ffd6ed
+           * it causes distress (RHBZ#1168144).
ffd6ed
+           *)
ffd6ed
+          if verbose then
ffd6ed
+            warning ~prog (f_"%s (ignored)") msg
ffd6ed
       )
ffd6ed
   ) fses
ffd6ed
 
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed