diff --git a/SOURCES/0038-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch b/SOURCES/0038-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch new file mode 100644 index 0000000..fad0c66 --- /dev/null +++ b/SOURCES/0038-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch @@ -0,0 +1,25 @@ +From 919e2fdf65377bc2496a696cb10eac3881324611 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 9 Jul 2024 11:30:09 +0100 +Subject: [PATCH] RHEL: Add warning about virt-v2v-in-place not being supported + +Fixes: https://issues.redhat.com/browse/RHEL-40903 +(cherry picked from commit 1dec94e52974e45fd3962dcbd51882fde7e9c306) +--- + in-place/in_place.ml | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/in-place/in_place.ml b/in-place/in_place.ml +index a61d9795..d55f49a0 100644 +--- a/in-place/in_place.ml ++++ b/in-place/in_place.ml +@@ -197,6 +197,9 @@ read the man page virt-v2v-in-place(1). + let opthandle = create_standard_options argspec ~anon_fun ~key_opts:true ~machine_readable:true usage_msg in + Getopt.parse opthandle.getopt; + ++ warning "virt-v2v-in-place is NOT SUPPORTED for command line use. \ ++ It is almost always better to use virt-v2v instead of this tool."; ++ + (* Print the version, easier than asking users to tell us. *) + debug "%s: %s %s (%s)" + prog Config.package_name Config.package_version_full diff --git a/SOURCES/0039-convert-windows-Online-all-virtio-disks-at-first-boo.patch b/SOURCES/0039-convert-windows-Online-all-virtio-disks-at-first-boo.patch new file mode 100644 index 0000000..603bdd8 --- /dev/null +++ b/SOURCES/0039-convert-windows-Online-all-virtio-disks-at-first-boo.patch @@ -0,0 +1,93 @@ +From c36ec998cc50124300ae0b31ef844b193b2db00f Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 27 Aug 2024 12:36:41 +0100 +Subject: [PATCH] convert: windows: Online all virtio disks at first boot + +Windows 2022 (and possibly earlier versions back to around 2019) will +force offline any non-boot disks which change bus, apparently as a +security mitigation. The effect of this is that although the system +drive (C:) is present after conversion, other drives may seem to +disappear. + +Running a Powershell script to bring all disks online seems risky. +The compromise is to bring online only virtio disks at first boot. + +To further reduce risk, we only do this if there are non-system disks +(ie. > 1 disks in total), and only if we installed virtio drivers. + +Fixes: https://issues.redhat.com/browse/RHEL-55763 +Fixes: https://issues.redhat.com/browse/RHEL-55837 +Related: https://issues.redhat.com/browse/MTV-1299 +Related: https://bugzilla.redhat.com/show_bug.cgi?id=1662286 +Signed-off-by: Richard W.M. Jones +Thanks: Martin Necas +Acked-by: Martin Necas +(cherry picked from commit cb56f6f94dc153051515fc7aa0d9ca646f5e2340) +--- + convert/convert_windows.ml | 39 +++++++++++++++++++++++++++++++++++++- + 1 file changed, 38 insertions(+), 1 deletion(-) + +diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml +index 2ff60bad..28f81e23 100644 +--- a/convert/convert_windows.ml ++++ b/convert/convert_windows.ml +@@ -38,7 +38,8 @@ module G = Guestfs + * time the Windows VM is booted on KVM. + *) + +-let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = ++let convert (g : G.guestfs) source inspect i_firmware ++ block_driver _ static_ips = + (*----------------------------------------------------------------------*) + (* Inspect the Windows guest. *) + +@@ -272,6 +273,8 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = + Registry.with_hive_write g inspect.i_windows_software_hive + update_software_hive; + ++ configure_online_disks block_driver; ++ + configure_network_interfaces net_driver; + + fix_ntfs_heads (); +@@ -662,6 +665,40 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = + warning (f_"could not find registry key \ + HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion") + ++ and configure_online_disks block_driver = ++ (* If there are > 1 disks, run a script which will force Windows ++ * to bring them all online. Windows 2022 will offline non-boot disks ++ * where the bus changes as some sort of "security" mitigation. ++ * https://issues.redhat.com/browse/RHEL-55837 ++ * https://issues.redhat.com/browse/MTV-1299 ++ * https://bugzilla.redhat.com/show_bug.cgi?id=1662286 ++ *) ++ let virtio_installed = ++ match block_driver with ++ | Inject_virtio_win.Virtio_blk | Virtio_SCSI -> true ++ | IDE -> false in ++ let more_than_one_disk = List.length source.s_disks > 1 in ++ ++ if virtio_installed && more_than_one_disk then ( ++ let psh_filename = "online-disks" in ++ let psh = ref [] in ++ let add = List.push_back psh in ++ ++ add "# Uncomment this line for lots of debug output."; ++ add "# Set-PSDebug -Trace 1"; ++ add ""; ++ add "Write-Host \"Online all virtio disks\""; ++ add ""; ++ add "Get-Disk | Where { $_.FriendlyName -like '*VirtIO*' } | % {"; ++ add " Write-Host (' - ' + $_.Number + ': ' + $_.FriendlyName + '(' + [math]::Round($_.Size/1GB,2) + 'GB)')"; ++ add " $_ | Set-Disk -IsOffline $false"; ++ add " $_ | Set-Disk -IsReadOnly $false"; ++ add "}"; ++ ++ (* Install the Powershell script to run late at firstboot. *) ++ Firstboot.add_firstboot_powershell g inspect.i_root psh_filename !psh ++ ) ++ + and configure_network_interfaces net_driver = + (* If we were asked to force network interfaces to have particular + * static IP addresses then it is done here by installing a diff --git a/SPECS/virt-v2v.spec b/SPECS/virt-v2v.spec index 366d7a4..31e8ef1 100644 --- a/SPECS/virt-v2v.spec +++ b/SPECS/virt-v2v.spec @@ -16,7 +16,7 @@ Name: virt-v2v Epoch: 1 Version: 2.4.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Convert a virtual machine to run on KVM License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -73,6 +73,8 @@ Patch0034: 0034-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch Patch0035: 0035-Update-common-submodule.patch Patch0036: 0036-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch Patch0037: 0037-docs-Restate-position-on-removal-of-VMware-Tools.patch +Patch0038: 0038-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch +Patch0039: 0039-convert-windows-Online-all-virtio-disks-at-first-boo.patch %if !0%{?rhel} # libguestfs hasn't been built on i686 for a while since there is no @@ -286,8 +288,10 @@ ln -sf ../../i686-w64-mingw32/sys-root/mingw/bin/pnp_wait.exe popd %if 0%{?rhel} -# On RHEL remove virt-v2v-in-place. -rm $RPM_BUILD_ROOT%{_bindir}/virt-v2v-in-place +# On RHEL move virt-v2v-in-place to libexec since it is not supported, +# and remove the documentation. +mkdir -p $RPM_BUILD_ROOT%{_libexecdir} +mv $RPM_BUILD_ROOT%{_bindir}/virt-v2v-in-place $RPM_BUILD_ROOT%{_libexecdir}/ rm $RPM_BUILD_ROOT%{_mandir}/man1/virt-v2v-in-place.1* %endif @@ -340,6 +344,8 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check %{_bindir}/virt-v2v %if !0%{?rhel} %{_bindir}/virt-v2v-in-place +%else +%{_libexecdir}/virt-v2v-in-place %endif %{_bindir}/virt-v2v-inspector %{_mandir}/man1/virt-v2v.1* @@ -377,6 +383,12 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check %changelog +* Tue Aug 27 2024 Richard W.M. Jones - 1:2.4.0-4 +- convert: windows: Online all virtio disks at first boot + resolves: RHEL-55837 +- Bundle virt-v2v-in-place for use by MTV + resolves: RHEL-55823 + * Tue Aug 13 2024 Richard W.M. Jones - 1:2.4.0-3 - Fixes to improve installation of QEMU Guest Agent and removal of VMware Tools