[Libguestfs] [PATCH] resize: make available expand method warnings more prominent

Pino Toscano ptoscano at redhat.com
Mon Jun 15 14:10:07 UTC 2015


When hitting a filesystem which we cannot or don't know how to expand,
instead of print a warning in verbose mode only, print it always when
showing the summary of the changes.

In the virt-resize documentation, add a paragraph about this warning.
---
 resize/resize.ml       | 30 +++++++++++++++++++++++-------
 resize/virt-resize.pod | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index 602a583..9ea5f8a 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -575,11 +575,7 @@ read the man page virt-resize(1).
       | ContentFS (("ntfs"), _) when !ntfs_available -> true
       | ContentFS (("btrfs"), _) when !btrfs_available -> true
       | ContentFS (("xfs"), _) when !xfs_available -> true
-      | ContentFS (fs, _) ->
-        if verbose () then
-          warning (f_"unknown/unavailable method for expanding filesystem %s")
-            fs;
-        false
+      | ContentFS (fs, _) -> false
       | ContentExtendedPartition -> false
     else
       fun _ -> false
@@ -863,7 +859,17 @@ read the man page virt-resize(1).
                 p.p_name
                 (string_of_expand_content_method
                    (expand_content_method p.p_type))
-            ) else "" in
+            ) else (
+              (match p.p_type with
+              | ContentUnknown
+              | ContentPV _
+              | ContentExtendedPartition -> ()
+              | ContentFS (fs, _) ->
+                warning (f_"unknown/unavailable method for expanding the %s filesystem on %s")
+                  fs p.p_name;
+              );
+              ""
+            ) in
 
       wrap (text ^ "\n\n") in
 
@@ -883,7 +889,17 @@ read the man page virt-resize(1).
                   name
                   (string_of_expand_content_method
                      (expand_content_method lv.lv_type))
-              ) else "" in
+              ) else (
+                (match lv.lv_type with
+                | ContentUnknown
+                | ContentPV _
+                | ContentExtendedPartition -> ()
+                | ContentFS (fs, _) ->
+                  warning (f_"unknown/unavailable method for expanding the %s filesystem on %s")
+                    fs name;
+                );
+                ""
+              ) in
 
             wrap (text ^ "\n\n")
     ) lvs;
diff --git a/resize/virt-resize.pod b/resize/virt-resize.pod
index d8da02f..26fd136 100644
--- a/resize/virt-resize.pod
+++ b/resize/virt-resize.pod
@@ -727,6 +727,45 @@ the disk before.
 If you have to reuse a target which contains data already, you should
 use the I<--no-sparse> option.  Note this can be much slower.
 
+=head2 "unknown/unavailable method for expanding the TYPE filesystem on DEVICE/LV"
+
+Virt-resize was asked to expand a partition or a logical volume
+containing a filesystem with the type C<TYPE>, but there is no
+available nor known expanding method for that filesystem.
+
+This may be due to either of the following:
+
+=over 4
+
+=item 1.
+
+There corresponding filesystem is not available in libguestfs,
+because there is no proper package in the host with utilities for it.
+This is usually the case for C<btrfs>, C<ntfs>, and C<xfs>
+filesystems.
+
+Check the results of:
+
+ virt-resize --machine-readable
+ guestfish -a /dev/null run : available
+ guestfish -a /dev/null run : filesystem_available TYPE
+
+In this case, it is enough to install the proper packages
+adding support for them.  For example, C<libguestfs-xfs> on
+Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, and distributions
+derived from them, for supporting the C<xfs> filesystem.
+
+=item 2.
+
+Virt-resize has no support for expanding that type of filesystem.
+
+In this case, there's nothing that can be done to let virt-resize
+expand that type of filesystem.
+
+=back
+
+In both cases, virt-resize will not expand the mentioned filesystem.
+
 =head1 ALTERNATIVE TOOLS
 
 There are several proprietary tools for resizing partitions.  We
-- 
2.1.0




More information about the Libguestfs mailing list