On Wed, Nov 27, 2019 at 06:00:21PM +0100, Pino Toscano wrote:
 Enough free space in a filesystem does not imply available inodes to
 create/modify files on that filesystem.  Hence, require at least 100
 available inodes on filesystems that can provide inode counts.
 ---
  v2v/v2v.ml | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
 
 diff --git a/v2v/v2v.ml b/v2v/v2v.ml
 index 03590c9e..b5b2da08 100644
 --- a/v2v/v2v.ml
 +++ b/v2v/v2v.ml
 @@ -375,6 +375,8 @@ and print_mpstat chan { mp_dev = dev; mp_path = path;
  (* Conversion can fail if there is no space on the guest filesystems
   * (RHBZ#1139543).  To avoid this situation, check there is some
   * headroom.  Mainly we care about the root filesystem.
 + *
 + * Also make sure filesystems have available inodes. (RHBZ#1764569)
   *)
  and check_guest_free_space mpstats =
    message (f_"Checking for sufficient free disk space in the guest");
 @@ -399,14 +401,21 @@ and check_guest_free_space mpstats =
        10_000_000L
    in
  
 +  (* Reasonable headroom for conversion operations. *)
 +  let needed_inodes = 100L in
 +
    List.iter (
 -    fun { mp_path; mp_statvfs = { G.bfree; bsize } } ->
 +    fun { mp_path; mp_statvfs = { G.bfree; bsize; files; ffree } } ->
        (* bfree = free blocks for root user *)
        let free_bytes = bfree *^ bsize in
        let needed_bytes = needed_bytes_for_mp mp_path in
        if free_bytes < needed_bytes then
          error (f_"not enough free space for conversion on filesystem ā%sā.  %Ld
bytes free < %Ld bytes needed")
 -          mp_path free_bytes needed_bytes
 +          mp_path free_bytes needed_bytes;
 +      (* Not all the filesystems have inode counts. *)
 +      if files > 0L && ffree < needed_inodes then
 +        error (f_"not enough available inodes for conversion on filesystem ā%sā. 
%Ld inodes available < %Ld inodes needed")
 +          mp_path ffree needed_inodes
    ) mpstats 
Looks good to me, however it does need the documentation updated here:
https://github.com/libguestfs/virt-v2v/blob/master/docs/virt-v2v.pod#free...
ACK with docs updated.
Rich.
-- 
Richard Jones, Virtualization Group, Red Hat 
http://people.redhat.com/~rjones
Read my programming and virtualization blog: 
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v