Re: [Libguestfs] [PATCH v2 2/2] resize: expand f2fs partitions

2018-04-16 Thread Richard W.M. Jones

ACK series.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH v2 2/2] resize: expand f2fs partitions

2018-04-15 Thread Pino Toscano
Use resize.f2fs (via f2fs_expand) to expand f2fs filesystems, if
available.
---
 resize/resize.ml   | 12 ++--
 resize/virt-resize.pod | 10 --
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index 1a21e4dff..8e4bb1b16 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -136,7 +136,7 @@ let debug_logvol lv =
 
 type expand_content_method =
   | PVResize | Resize2fs | NTFSResize | BtrfsFilesystemResize | XFSGrowFS
-  | Mkswap
+  | Mkswap | ResizeF2fs
 
 let string_of_expand_content_method = function
   | PVResize -> s_"pvresize"
@@ -145,6 +145,7 @@ let string_of_expand_content_method = function
   | BtrfsFilesystemResize -> s_"btrfs-filesystem-resize"
   | XFSGrowFS -> s_"xfs_growfs"
   | Mkswap -> s_"mkswap"
+  | ResizeF2fs -> s_"resize.f2fs"
 
 type unknown_filesystems_mode =
   | UnknownFsIgnore
@@ -295,6 +296,8 @@ read the man page virt-resize(1).
 printf "btrfs\n";
   if g#feature_available [| "xfs" |] then
 printf "xfs\n";
+  if g#feature_available [| "f2fs" |] then
+printf "f2fs\n";
   exit 0
 );
 
@@ -331,10 +334,11 @@ read the man page virt-resize(1).
 lv_expands, machine_readable, ntfsresize_force, output_format,
 resizes, resizes_force, shrink, sparse, unknown_fs_mode in
 
-  (* Default to true, since NTFS/btrfs/XFS support are usually available. *)
+  (* Default to true, since NTFS/btrfs/XFS/f2fs support are usually available. 
*)
   let ntfs_available = ref true in
   let btrfs_available = ref true in
   let xfs_available = ref true in
+  let f2fs_available = ref true in
 
   (* Add a drive to an handle using the elements of the URI,
* and few additional parameters.
@@ -364,6 +368,7 @@ read the man page virt-resize(1).
 ntfs_available := g#feature_available [|"ntfsprogs"; "ntfs3g"|];
 btrfs_available := g#feature_available [|"btrfs"|];
 xfs_available := g#feature_available [|"xfs"|];
+f2fs_available := g#feature_available [|"f2fs"|];
 
 g
   in
@@ -585,6 +590,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 (("f2fs"), _) when !f2fs_available -> true
   | ContentFS _ -> false
   | ContentExtendedPartition -> false
   | ContentSwap -> true
@@ -600,6 +606,7 @@ read the man page virt-resize(1).
   | ContentFS (("ntfs"), _) when !ntfs_available -> NTFSResize
   | ContentFS (("btrfs"), _) when !btrfs_available -> BtrfsFilesystemResize
   | ContentFS (("xfs"), _) when !xfs_available -> XFSGrowFS
+  | ContentFS (("f2fs"), _) when !f2fs_available -> ResizeF2fs
   | ContentFS _ -> assert false
   | ContentExtendedPartition -> assert false
   | ContentSwap -> Mkswap
@@ -1368,6 +1375,7 @@ read the man page virt-resize(1).
 if new_uuid <> orig_uuid then
   warning (f_"UUID in swap partition %s changed from ā€˜%sā€™ to ā€˜%sā€™")
 target orig_uuid new_uuid;
+  | ResizeF2fs -> g#f2fs_expand target
 in
 
 (* Expand partition content as required. *)
diff --git a/resize/virt-resize.pod b/resize/virt-resize.pod
index f6aeb5706..720318c4d 100644
--- a/resize/virt-resize.pod
+++ b/resize/virt-resize.pod
@@ -156,7 +156,8 @@ to fill the rest of the available space:
 If the expanded partition in the image contains a filesystem or LVM
 PV, then if virt-resize knows how, it will resize the contents, the
 equivalent of calling a command such as L,
-L, L, L or L.
+L, L, L, L,
+or L.
 However virt-resize does not know how to resize some filesystems, so
 you would have to online resize them after booting the guest.
 
@@ -407,6 +408,10 @@ Please note that libguestfs I the existing swap 
content
 by recreating it with C, so this should not be used when
 the guest is suspended.
 
+=item *
+
+f2fs filesystems, if libguestfs was compiled with support for f2fs.
+
 =back
 
 Note that you cannot use I<--expand> and I<--shrink> together.
@@ -775,7 +780,7 @@ This may be due to either of the following:
 
 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, C, and C
+This is usually the case for C, C, C, and C
 filesystems.
 
 Check the results of:
@@ -842,6 +847,7 @@ L,
 L,
 L,
 L,
+L,
 L,
 L,
 L,
-- 
2.14.3

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs