Pino Toscano
2019-Nov-27 17:00 UTC
[Libguestfs] [v2v PATCH] v2v: require 100 availabe inodes on each filesystem (RHBZ#1764569)
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 (* Perform the fstrim. *) -- 2.21.0
Richard W.M. Jones
2019-Nov-27 19:08 UTC
Re: [Libguestfs] [v2v PATCH] v2v: require 100 availabe inodes on each filesystem (RHBZ#1764569)
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 > ) mpstatsLooks good to me, however it does need the documentation updated here: https://github.com/libguestfs/virt-v2v/blob/master/docs/virt-v2v.pod#free-space-in-the-guest 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
Eric Blake
2019-Nov-27 19:26 UTC
Re: [Libguestfs] [v2v PATCH] v2v: require 100 availabe inodes on each filesystem (RHBZ#1764569)
On 11/27/19 11:00 AM, Pino Toscano wrote: In the subject: s/availabe/available/ also, is it necessary to stick RHBZ#... in the subject, or is that a better fit in the commit body?> 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. > ----- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2019-Nov-27 20:58 UTC
Re: [Libguestfs] [v2v PATCH] v2v: require 100 availabe inodes on each filesystem (RHBZ#1764569)
On Wed, Nov 27, 2019 at 01:26:28PM -0600, Eric Blake wrote:> On 11/27/19 11:00 AM, Pino Toscano wrote: > > In the subject: s/availabe/available/ > > also, is it necessary to stick RHBZ#... in the subject, or is that a > better fit in the commit body?I have a script I use for making the release notes that picks the RHBZ# string from the subject, so this would have to be changed if we changed this: https://github.com/libguestfs/libguestfs/blob/master/bugs-in-changelog.sh 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
Possibly Parallel Threads
- [v2v PATCH v2] v2v: require 100 available inodes on each filesystem
- [PATCH] v2v: rework free space check in guest mountpoints
- Re: [PATCH] v2v: rework free space check in guest mountpoints
- [PATCH v3 04/13] v2v: factor out size checks
- [PATCH v2 00/17] v2v: add --in-place mode