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.
Related to: RHBZ#1764569
---
docs/virt-v2v.pod | 3 +++
v2v/v2v.ml | 13 +++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 6d677a45..1c884616 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -1353,6 +1353,9 @@ Minimum free space: 10 MB
=back
+In addition to the actual free space, each filesystem is required to
+have at least 100 available inodes.
+
=head3 Minimum free space check in the host
You must have sufficient free space in the host directory used to
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index f9d81460..dc1dedd7 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
(* Perform the fstrim. *)
--
2.21.0