|
|
|
|
From 90e0e0cfe7d90bb9b8cc4a8eb9225266b1622453 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
|
|
Date: Thu, 15 Apr 2021 16:52:36 +0100
|
|
|
|
|
Subject: [PATCH] v2v: Increase required free space in Windows to 100 MB
|
|
|
|
|
|
|
|
|
|
With an increasing number of drivers being installed in Windows the
|
|
|
|
|
existing limit (20 MB) was far too low. In fact we found that a guest
|
|
|
|
|
with 63 MB of free space would sometimes run out of space.
|
|
|
|
|
|
|
|
|
|
This commit increases the required space to 100 MB for Windows.
|
|
|
|
|
|
|
|
|
|
There are also a couple of smaller fixes:
|
|
|
|
|
|
|
|
|
|
- We now properly distinguish between / as a Linux boot drive,
|
|
|
|
|
and Windows.
|
|
|
|
|
|
|
|
|
|
- The error message has been improved to display MBs instead of bytes.
|
|
|
|
|
|
|
|
|
|
Reported-by: Ming Xie
|
|
|
|
|
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1949147
|
|
|
|
|
(cherry picked from commit dfcf60c916a986a352938b432231a36558a3bc05)
|
|
|
|
|
---
|
|
|
|
|
docs/virt-v2v.pod | 8 +++++++-
|
|
|
|
|
v2v/v2v.ml | 46 +++++++++++++++++++++++++---------------------
|
|
|
|
|
2 files changed, 32 insertions(+), 22 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
|
|
|
|
|
index 50b0bc8e..4016c724 100644
|
|
|
|
|
--- a/docs/virt-v2v.pod
|
|
|
|
|
+++ b/docs/virt-v2v.pod
|
|
|
|
|
@@ -1288,7 +1288,7 @@ to perform the conversion. Currently it checks:
|
|
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
|
|
-=item Linux root filesystem or Windows C<C:> drive
|
|
|
|
|
+=item Linux root filesystem
|
|
|
|
|
|
|
|
|
|
Minimum free space: 20 MB
|
|
|
|
|
|
|
|
|
|
@@ -1299,6 +1299,12 @@ Minimum free space: 50 MB
|
|
|
|
|
This is because we need to build a new initramfs for some Enterprise
|
|
|
|
|
Linux conversions.
|
|
|
|
|
|
|
|
|
|
+=item Windows C<C:> drive
|
|
|
|
|
+
|
|
|
|
|
+Minimum free space: 100 MB
|
|
|
|
|
+
|
|
|
|
|
+We may have to copy in many virtio drivers and guest agents.
|
|
|
|
|
+
|
|
|
|
|
=item Any other mountable filesystem
|
|
|
|
|
|
|
|
|
|
Minimum free space: 10 MB
|
|
|
|
|
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
|
|
|
|
|
index 1f8d0138..bde51885 100644
|
|
|
|
|
--- a/v2v/v2v.ml
|
|
|
|
|
+++ b/v2v/v2v.ml
|
|
|
|
|
@@ -108,7 +108,7 @@ let rec main () =
|
|
|
|
|
let inspect = Inspect_source.inspect_source cmdline.root_choice g in
|
|
|
|
|
|
|
|
|
|
let mpstats = get_mpstats g in
|
|
|
|
|
- check_guest_free_space mpstats;
|
|
|
|
|
+ check_guest_free_space inspect mpstats;
|
|
|
|
|
|
|
|
|
|
(* Estimate space required on target for each disk. Note this is a max. *)
|
|
|
|
|
(match conversion_mode with
|
|
|
|
|
@@ -377,27 +377,28 @@ and print_mpstat chan { mp_dev = dev; mp_path = path;
|
|
|
|
|
*
|
|
|
|
|
* Also make sure filesystems have available inodes. (RHBZ#1764569)
|
|
|
|
|
*)
|
|
|
|
|
-and check_guest_free_space mpstats =
|
|
|
|
|
+and check_guest_free_space inspect mpstats =
|
|
|
|
|
message (f_"Checking for sufficient free disk space in the guest");
|
|
|
|
|
|
|
|
|
|
(* Check whether /boot has its own mount point. *)
|
|
|
|
|
let has_boot = List.exists (fun { mp_path } -> mp_path = "/boot") mpstats in
|
|
|
|
|
+ let is_windows = inspect.i_distro = "windows" in
|
|
|
|
|
|
|
|
|
|
- let needed_bytes_for_mp = function
|
|
|
|
|
- | "/boot"
|
|
|
|
|
- | "/" when not has_boot ->
|
|
|
|
|
- (* We usually regenerate the initramfs, which has a
|
|
|
|
|
- * typical size of 20-30MB. Hence:
|
|
|
|
|
- *)
|
|
|
|
|
- 50_000_000L
|
|
|
|
|
- | "/" ->
|
|
|
|
|
- (* We may install some packages, and they would usually go
|
|
|
|
|
- * on the root filesystem.
|
|
|
|
|
- *)
|
|
|
|
|
- 20_000_000L
|
|
|
|
|
- | _ ->
|
|
|
|
|
- (* For everything else, just make sure there is some free space. *)
|
|
|
|
|
- 10_000_000L
|
|
|
|
|
+ let needed_megabytes_for_mp = function
|
|
|
|
|
+ (* We usually regenerate the initramfs, which has a
|
|
|
|
|
+ * typical size of 20-30MB. Hence:
|
|
|
|
|
+ *)
|
|
|
|
|
+ | "/boot" | "/" when not has_boot && not is_windows -> 50
|
|
|
|
|
+ (* We may install some packages, and they would usually go
|
|
|
|
|
+ * on the root filesystem.
|
|
|
|
|
+ *)
|
|
|
|
|
+ | "/" when not is_windows -> 20
|
|
|
|
|
+ (* Windows requires copying in many device drivers and possibly
|
|
|
|
|
+ * guest agents, so we need more space. (RHBZ#1949147).
|
|
|
|
|
+ *)
|
|
|
|
|
+ | "/" (* when is_windows *) -> 100
|
|
|
|
|
+ (* For everything else, just make sure there is some free space. *)
|
|
|
|
|
+ | _ -> 10
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
(* Reasonable headroom for conversion operations. *)
|
|
|
|
|
@@ -407,10 +408,13 @@ and check_guest_free_space mpstats =
|
|
|
|
|
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;
|
|
|
|
|
+ let needed_megabytes = needed_megabytes_for_mp mp_path in
|
|
|
|
|
+ let needed_bytes = Int64.of_int needed_megabytes *^ 1024L *^ 1024L in
|
|
|
|
|
+ if free_bytes < needed_bytes then (
|
|
|
|
|
+ let mb i = Int64.to_float i /. 1024. /. 1024. in
|
|
|
|
|
+ error (f_"not enough free space for conversion on filesystem ‘%s’. %.1f MB free < %d MB needed")
|
|
|
|
|
+ mp_path (mb free_bytes) needed_megabytes
|
|
|
|
|
+ );
|
|
|
|
|
(* 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")
|