convert: fix boot order for multi-OS Windows guests#149
convert: fix boot order for multi-OS Windows guests#149ssahani wants to merge 2 commits intolibguestfs:masterfrom
Conversation
|
What testing has been done on this patch? |
It's hard to prepare a disk like this. I wrote a test case. |
|
Since this is about Windows booting, a phony Windows test isn't really testing anything. |
Yes Need to setup real env. |
|
Test scenario creation: Disk 1 — Blank data disk (blank-data.qcow2): We just created an empty 10G qcow2 image with no partitions, no filesystem, nothing on it: qemu-img create -f qcow2 /var/lib/libvirt/images/blank-data.qcow2 10G It's only 196 KiB on disk since it's completely empty. The whole point of this disk is to sit as the first disk (sda) so the Windows disk gets pushed to sdb, which Disk 2 — Windows 11 OS disk (win11-boot-test.qcow2): This is a real Windows 11 installation from a working KVM guest. We installed Windows 11 in a VM normally and then copied the resulting disk image to Putting them together: We defined a libvirt guest windows-multi-disk-test with both disks attached — blank-data as vda (first disk) and win11-boot-test as vdb (second disk). This way when virt-v2v via ./run to convert the guest, explicitly selecting the Windows root on the second disk: Debug log confirms the fix is active: Previously, get_target_boot_device in convert/convert.ml returned None immediately for all non-Linux guests, assuming Windows always boots from the first disk. The Takes inspect.i_root (the user-selected root, e.g. /dev/sdb3) Calls g#part_to_dev to get the parent disk (/dev/sdb) Calls g#device_index to get the disk index (1) Returns that index so the correct disk gets boot order='1' This resolves the bug where multi-OS Windows guests couldn't boot into the selected OS after v2v conversion. |
| SRCDIR=$(srcdir) $(top_builddir)/run --test ./$< $@ | ||
|
|
||
| # Make (dummy) multi-disk Windows images (for boot order testing). | ||
| windows-multi-disk-sda.img windows-multi-disk-sdb.img: make-windows-multi-disk-img.sh \ |
There was a problem hiding this comment.
This only works by accident (because of the .NOTPARALLEL directive in the Makefile). You have to use a stamp file to stop the command being run twice.
|
The bug reporter used two Windows instances rather than a blank disk, but fine I suppose. Also please stop using LLMs, you'll not learn anything by using them. The Resolves line should be |
Use inspect.i_root to determine the boot disk for non-Linux guests, so the correct disk gets boot order=1 in the output XML. Fixes: https://redhat.atlassian.net/browse/RHEL-122817
Verify that when Windows is on the second disk, virt-v2v assigns boot order 1 to the correct disk in the output XML.
It was hard to create this scenario. Shall update it |
2c351f6 to
5ea8322
Compare
|
Updated Thanks ! |
Use inspect.i_root to determine the boot disk for non-Linux guests, so the correct disk gets boot order=1 in the output XML.
Fixes: https://redhat.atlassian.net/browse/RHEL-161193