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