Blob Blame History Raw
From 91db4de9f068eb7d90f30e1d7205b3f0c988cce7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Aug 2016 10:32:26 +0100
Subject: [PATCH] v2v: Make fstrim warning clearer (RHBZ#1366456).

This reverts the change made for RHBZ#1168144.  The warning is now
always displayed.

It would be nice to make the warning actionable, but there is not a
lot that end users can do since fstrim is such a complex topic
interacting with all filesystem and storage layers.

(cherry picked from commit 66816e11332b07a07efd6821e7ecf090691ce441)
---
 v2v/v2v.ml       |  6 +-----
 v2v/virt-v2v.pod | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 4b06bc1..21f8d77 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -425,11 +425,7 @@ and do_fstrim g no_trim inspect =
       if mounted then (
         try g#fstrim "/"
         with G.Error msg ->
-          (* Only emit this warning when debugging, because otherwise
-           * it causes distress (RHBZ#1168144).
-           *)
-          if verbose () then
-            warning (f_"%s (ignored)") msg
+          warning (f_"fstrim on guest filesystem %s failed.  Usually you can ignore this message.  To find out more read \"Trimming\" in virt-v2v(1).\n\nOriginal message: %s") dev msg
       )
   ) fses
 
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index 9fc0b72..434f57e 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -1512,6 +1512,32 @@ one CPU core and between 512 MB and 1 GB of RAM per running instance.
 
 Virt-v2v can be run in a virtual machine.
 
+=head2 Trimming
+
+Virt-v2v attempts to optimize the speed of conversion by ignoring
+guest filesystem data which is not used.  This would include unused
+filesystem blocks, blocks containing zeroes, and deleted files.
+
+To do this, virt-v2v issues a non-destructive L<fstrim(8)> operation.
+As this happens to an overlay placed over the guest data, it does
+B<not> affect the source in any way.
+
+If this fstrim operation fails, you will see a warning, but virt-v2v
+will continue anyway.  It may run more slowly (in some cases much more
+slowly), because it is copying the unused parts of the disk.
+
+Unfortunately support for fstrim is not universal, and it also depends
+on specific details of the filesystem, partition alignment, and
+backing storage.  As an example, NTFS filesystems cannot be fstrimmed
+if they occupy a partition which is not aligned to the underlying
+storage.  That was the default on Windows before Vista.  As another
+example, VFAT filesystems (used by UEFI guests) cannot be trimmed at
+all.
+
+fstrim support in the Linux kernel is improving gradually, so over
+time some of these restrictions will be lifted and virt-v2v will work
+faster.
+
 =head1 POST-CONVERSION TASKS
 
 =head2 Guest network configuration
-- 
1.8.3.1