Fix conversion of Windows BitLocker guests

resolves: rhbz#1994984
This commit is contained in:
Richard W.M. Jones 2021-08-18 11:12:15 +01:00
parent 68303dfb29
commit dd04127f3d
13 changed files with 97 additions and 12 deletions

View File

@ -1,7 +1,7 @@
From 4d5509a98823cc0b8930678716b862adbd2c0b81 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 6 Aug 2021 13:01:28 +0100
Subject: [PATCH 01/11] Revert "v2v: Remove -o rhv-upload -oa preallocated"
Subject: [PATCH 01/12] Revert "v2v: Remove -o rhv-upload -oa preallocated"
This reverts commit 18084f90d9dd9092831cb3487039328981796291.
---

View File

@ -1,7 +1,7 @@
From abe3c7539b6221e8ab3cc35ee3d58b1aa06bbef4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 14 May 2018 10:16:58 +0100
Subject: [PATCH 02/11] RHEL: v2v: rhv-upload: Remove restriction on -oa
Subject: [PATCH 02/12] RHEL: v2v: rhv-upload: Remove restriction on -oa
sparse.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1565681

View File

@ -1,7 +1,7 @@
From 0839ba57487b73cfb684ea495280db5d946f667a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Sep 2014 19:14:43 +0100
Subject: [PATCH 03/11] RHEL: v2v: Select correct qemu binary for -o qemu mode
Subject: [PATCH 03/12] RHEL: v2v: Select correct qemu binary for -o qemu mode
(RHBZ#1147313).
RHEL does not have qemu-system-x86_64 (etc), and in addition the

View File

@ -1,7 +1,7 @@
From bb55b78b68e6e8039734eb1d7af22b455f8fbdc2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 Sep 2014 10:50:27 +0100
Subject: [PATCH 04/11] RHEL: v2v: Disable the --qemu-boot option
Subject: [PATCH 04/12] RHEL: v2v: Disable the --qemu-boot option
(RHBZ#1147313).
This cannot work because there is no Gtk or SDL output mode

View File

@ -1,7 +1,7 @@
From 49385571ce5967f8d9a102e935f201ee9c22326d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 24 Apr 2015 09:45:41 -0400
Subject: [PATCH 05/11] RHEL: Fix list of supported sound cards to match RHEL
Subject: [PATCH 05/12] RHEL: Fix list of supported sound cards to match RHEL
qemu (RHBZ#1176493).
---

View File

@ -1,7 +1,7 @@
From db2150a5d790c35fb23c6d9d6b29e602482ce555 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 30 Aug 2015 03:21:57 -0400
Subject: [PATCH 06/11] RHEL: Fix tests for libguestfs-winsupport.
Subject: [PATCH 06/12] RHEL: Fix tests for libguestfs-winsupport.
It doesn't let us use guestfish for arbitrary Windows edits.
---

View File

@ -1,7 +1,7 @@
From 3b69cfa365c7b014ca81b09e857ab294cff04914 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 14 Jan 2016 11:53:42 -0500
Subject: [PATCH 07/11] RHEL: v2v: Disable the virt-v2v --in-place option.
Subject: [PATCH 07/12] RHEL: v2v: Disable the virt-v2v --in-place option.
This disables the virt-v2v --in-place option which we do not
wish to support in RHEL.

View File

@ -1,7 +1,7 @@
From e57a5dafc00b3b5737824977aad0feb0ec497a1f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Mar 2017 14:21:37 +0100
Subject: [PATCH 08/11] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)
Subject: [PATCH 08/12] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)
The SDL output mode is not supported in RHEL's qemu-kvm.
---

View File

@ -1,7 +1,7 @@
From aa5cf3ba5d10400ee6d6c63dd77c711b6fdec116 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 8 Mar 2017 11:03:40 +0100
Subject: [PATCH 09/11] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203)
Subject: [PATCH 09/12] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203)
They are not supported in RHEL.
---

View File

@ -1,7 +1,7 @@
From ccaae02ef3f081b544eca82f3652ca50ac5566a9 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Mar 2019 09:42:25 +0100
Subject: [PATCH 10/11] RHEL: point to KB for supported v2v hypervisors/guests
Subject: [PATCH 10/12] RHEL: point to KB for supported v2v hypervisors/guests
---
docs/virt-v2v-support.pod | 104 ++------------------------------------

View File

@ -1,7 +1,7 @@
From 7edb403ee54153c64205915c0bd1d177c0094ee0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 30 Jun 2021 11:15:52 +0100
Subject: [PATCH 11/11] RHEL 9: Disable -o glance
Subject: [PATCH 11/12] RHEL 9: Disable -o glance
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1977539
---

View File

@ -0,0 +1,80 @@
From 5581ad03910a3b0d198176453c92ad714343697d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 18 Aug 2021 11:00:12 +0100
Subject: [PATCH 12/12] v2v: windows: Do not fix NTFS heads in Windows Vista
and later
Setting/adjusting the number of drive heads in the NTFS header is only
necessary for ancient versions of Windows. Modern versions ignore
this. In addition this operation broke when we added BitLocker
support. Only do this for ancient Windows 2000/XP and skip it for
everything else.
Reported-by: Ming Xie
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1994984
(cherry picked from commit 0a394c5c2f802098c9e481b4bacee7821e5dd0ae)
---
v2v/convert_windows.ml | 44 ++++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index 52e45599..1ed1d59e 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -710,30 +710,32 @@ if errorlevel 3010 exit /b 0
however, as this is specific to Windows 2003 it lists location
0x1A as unused.
*)
- let rootpart = inspect.i_root in
+ if inspect.i_major_version < 6 (* is Windows 2000/XP *) then (
+ let rootpart = inspect.i_root in
- (* Ignore if the rootpart is something like /dev/sda. RHBZ#1276540. *)
- if not (g#is_whole_device rootpart) then (
- (* Check that the root device contains NTFS magic. *)
- let magic = g#pread_device rootpart 8 3L in
- if magic = "NTFS " then (
- (* Get the size of the whole disk containing the root partition. *)
- let rootdev = g#part_to_dev rootpart in (* eg. /dev/sda *)
- let size = g#blockdev_getsize64 rootdev in
+ (* Ignore if the rootpart is something like /dev/sda. RHBZ#1276540. *)
+ if not (g#is_whole_device rootpart) then (
+ (* Check that the root device contains NTFS magic. *)
+ let magic = g#pread_device rootpart 8 3L in
+ if magic = "NTFS " then (
+ (* Get the size of the whole disk containing the root partition. *)
+ let rootdev = g#part_to_dev rootpart in (* eg. /dev/sda *)
+ let size = g#blockdev_getsize64 rootdev in
- let heads = (* refer to the table above *)
- if size < 2114445312L then 0x40
- else if size < 4228374780L then 0x80
- else 0xff in
+ let heads = (* refer to the table above *)
+ if size < 2114445312L then 0x40
+ else if size < 4228374780L then 0x80
+ else 0xff in
- (* Update NTFS's idea of the number of heads. This is an
- * unsigned 16 bit little-endian integer, offset 0x1a from the
- * beginning of the partition.
- *)
- let b = Bytes.create 2 in
- Bytes.unsafe_set b 0 (Char.chr heads);
- Bytes.unsafe_set b 1 '\000';
- ignore (g#pwrite_device rootpart (Bytes.to_string b) 0x1a_L)
+ (* Update NTFS's idea of the number of heads. This is an
+ * unsigned 16 bit little-endian integer, offset 0x1a from the
+ * beginning of the partition.
+ *)
+ let b = Bytes.create 2 in
+ Bytes.unsafe_set b 0 (Char.chr heads);
+ Bytes.unsafe_set b 1 '\000';
+ ignore (g#pwrite_device rootpart (Bytes.to_string b) 0x1a_L)
+ )
)
)
--
2.31.1

View File

@ -15,7 +15,7 @@
Name: virt-v2v
Epoch: 1
Version: 1.45.3
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -61,6 +61,7 @@ Patch9008: 0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch9009: 0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch9010: 0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch9011: 0011-RHEL-9-Disable-o-glance.patch
Patch9012: 0012-v2v-windows-Do-not-fix-NTFS-heads-in-Windows-Vista-a.patch
%endif
%if 0%{patches_touch_autotools}
@ -287,6 +288,10 @@ popd
%changelog
* Wed Aug 18 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.45.3-3
- Fix conversion of Windows BitLocker guests
resolves: rhbz#1994984
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.45.3-2
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688