Laszlo Ersek
2021-Sep-29 19:07 UTC
[Libguestfs] [virt-v2v PATCH 2/4] test-v2v-cdrom: update the CD-ROM's bus to SATA in the converted domain
On 09/27/21 10:30, Richard W.M. Jones wrote:> On Mon, Sep 27, 2021 at 08:34:56AM +0200, Laszlo Ersek wrote: >> Per commit ac39fa292c31 ("v2v: Set machine type explicitly for outputs >> which support it (RHBZ#1581428).", 2020-12-04), Windows 7 guests (which >> are "more modern" than Windows XP guests) are converted to Q35, not I440FX >> boards. >> >> Per related commit d0267122e348 ("v2v: -o libvirt: Map IDE disks to >> bus="sata" on Q35.", 2020-12-04), when a Windows 7 guest with an IDE >> CD-ROM -- hence, an I440FX board -- is converted, the CD-ROM in the >> converted domain will be on the SATA bus (Q35 does not have an IDE >> controller, only a SATA controller). >> >> Because the Windows guest used in "test-v2v-cdrom" is "Windows 7 Phony >> Edition", it triggers the above cascade, and currently fails with: >> >>> --- ./test-v2v-cdrom.expected 2021-09-03 22:51:31.026185527 +0200 >>> +++ test-v2v-cdrom.d/disks 2021-09-19 13:01:47.471745622 +0200 >>> @@ -4,5 +4,5 @@ >>> </disk> >>> <disk device='cdrom' type='file'> >>> <driver name='qemu' type='raw'/> >>> - <target dev='hdc' bus='ide'/> >>> + <target dev='sdc' bus='sata'/> >>> </disk> >>> ./test-v2v-cdrom.sh: unexpected disk assignments >> >> The conversion seems correct, but the test expectation is stale. Most >> probably, commit d0267122e348 missed updating the test data. Do it now. > > Actually the conversion is wrong - we need to update configuration > inside the guest. Which is why I didn't fix this test - to remind > myself that there's still a bug to be fixed.Hmm, good point; now I remember that the i440fx->q35 machine type change is basically a motherboard replacement for Windows. So do we have to update some "windows device paths" (leading to the CD-ROM) in the registry? Thanks, Laszlo> > https://bugzilla.redhat.com/show_bug.cgi?id=1637857 > > Rich. > >> Fixes: d0267122e348202f6fac4d833f7448409e7129c9 >> Signed-off-by: Laszlo Ersek <lersek at redhat.com> >> --- >> tests/test-v2v-cdrom.expected | 2 +- >> tests/test-v2v-cdrom.xml.in | 4 +++- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/tests/test-v2v-cdrom.expected b/tests/test-v2v-cdrom.expected >> index 34d2bf5961b0..17bd152d8e64 100644 >> --- a/tests/test-v2v-cdrom.expected >> +++ b/tests/test-v2v-cdrom.expected >> @@ -4,5 +4,5 @@ >> </disk> >> <disk device='cdrom' type='file'> >> <driver name='qemu' type='raw'/> >> - <target dev='hdc' bus='ide'/> >> + <target dev='sdc' bus='sata'/> >> </disk> >> diff --git a/tests/test-v2v-cdrom.xml.in b/tests/test-v2v-cdrom.xml.in >> index 6bad5eab1cd4..a6e1e3f514d5 100644 >> --- a/tests/test-v2v-cdrom.xml.in >> +++ b/tests/test-v2v-cdrom.xml.in >> @@ -35,7 +35,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >> <disk type='file' device='cdrom'> >> <driver name='qemu' type='raw'/> >> <source file='@abs_top_builddir@/test-data/phony-guests/blank-disk.img'/> >> - <!-- virt-v2v should preserve the device name and bus --> >> + <!-- virt-v2v should change the bus to sata, due to Windows 7 >> + triggering a machine type change from i440fx to q35. Beyond that, >> + virt-v2v should preserve the on-bus index. --> >> <target dev='hdc' bus='ide'/> >> </disk> >> </devices> >> -- >> 2.19.1.3.g30247aa5d201 >> >> >> _______________________________________________ >> Libguestfs mailing list >> Libguestfs at redhat.com >> https://listman.redhat.com/mailman/listinfo/libguestfs >
Richard W.M. Jones
2021-Sep-29 19:22 UTC
[Libguestfs] [virt-v2v PATCH 2/4] test-v2v-cdrom: update the CD-ROM's bus to SATA in the converted domain
On Wed, Sep 29, 2021 at 09:07:57PM +0200, Laszlo Ersek wrote:> On 09/27/21 10:30, Richard W.M. Jones wrote: > > On Mon, Sep 27, 2021 at 08:34:56AM +0200, Laszlo Ersek wrote: > >> Per commit ac39fa292c31 ("v2v: Set machine type explicitly for outputs > >> which support it (RHBZ#1581428).", 2020-12-04), Windows 7 guests (which > >> are "more modern" than Windows XP guests) are converted to Q35, not I440FX > >> boards. > >> > >> Per related commit d0267122e348 ("v2v: -o libvirt: Map IDE disks to > >> bus="sata" on Q35.", 2020-12-04), when a Windows 7 guest with an IDE > >> CD-ROM -- hence, an I440FX board -- is converted, the CD-ROM in the > >> converted domain will be on the SATA bus (Q35 does not have an IDE > >> controller, only a SATA controller). > >> > >> Because the Windows guest used in "test-v2v-cdrom" is "Windows 7 Phony > >> Edition", it triggers the above cascade, and currently fails with: > >> > >>> --- ./test-v2v-cdrom.expected 2021-09-03 22:51:31.026185527 +0200 > >>> +++ test-v2v-cdrom.d/disks 2021-09-19 13:01:47.471745622 +0200 > >>> @@ -4,5 +4,5 @@ > >>> </disk> > >>> <disk device='cdrom' type='file'> > >>> <driver name='qemu' type='raw'/> > >>> - <target dev='hdc' bus='ide'/> > >>> + <target dev='sdc' bus='sata'/> > >>> </disk> > >>> ./test-v2v-cdrom.sh: unexpected disk assignments > >> > >> The conversion seems correct, but the test expectation is stale. Most > >> probably, commit d0267122e348 missed updating the test data. Do it now. > > > > Actually the conversion is wrong - we need to update configuration > > inside the guest. Which is why I didn't fix this test - to remind > > myself that there's still a bug to be fixed. > > Hmm, good point; now I remember that the i440fx->q35 machine type change > is basically a motherboard replacement for Windows. > > So do we have to update some "windows device paths" (leading to the > CD-ROM) in the registry?We currently partially install the virtio block drivers in the Windows guest (just enough to get the guest to boot on the target), and Windows itself re-installs the virtio block driver and other drivers it needs, and that's enough to get it to see C: As for other hard disk partitions, Windows does indeed contain a mapping to other drives in the Registry but IIRC it's not sensitive to the device driver (unlike Linux /dev/vdX vs /dev/sdX). If you're interested in that, see libguestfs.git/daemon/inspect_fs_windows.ml: get_drive_mappings. We never bothered with attempting to handle conversion of floppy drives or CD-ROMs for Windows. On Linux we do better: We iterate over all the configuration files in /etc and change device paths. The significance of this bug is we need to change (eg) /dev/hdc to /dev/<something>. The difficulty is working out where the device will appear on the target and not having it conflict with any hard disk, something we partly control (see virt-v2v.git/convert/target_bus_assignment.ml*) Rich.> Thanks, > Laszlo > > > > > https://bugzilla.redhat.com/show_bug.cgi?id=1637857 > > > > Rich. > > > >> Fixes: d0267122e348202f6fac4d833f7448409e7129c9 > >> Signed-off-by: Laszlo Ersek <lersek at redhat.com> > >> --- > >> tests/test-v2v-cdrom.expected | 2 +- > >> tests/test-v2v-cdrom.xml.in | 4 +++- > >> 2 files changed, 4 insertions(+), 2 deletions(-) > >> > >> diff --git a/tests/test-v2v-cdrom.expected b/tests/test-v2v-cdrom.expected > >> index 34d2bf5961b0..17bd152d8e64 100644 > >> --- a/tests/test-v2v-cdrom.expected > >> +++ b/tests/test-v2v-cdrom.expected > >> @@ -4,5 +4,5 @@ > >> </disk> > >> <disk device='cdrom' type='file'> > >> <driver name='qemu' type='raw'/> > >> - <target dev='hdc' bus='ide'/> > >> + <target dev='sdc' bus='sata'/> > >> </disk> > >> diff --git a/tests/test-v2v-cdrom.xml.in b/tests/test-v2v-cdrom.xml.in > >> index 6bad5eab1cd4..a6e1e3f514d5 100644 > >> --- a/tests/test-v2v-cdrom.xml.in > >> +++ b/tests/test-v2v-cdrom.xml.in > >> @@ -35,7 +35,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >> <disk type='file' device='cdrom'> > >> <driver name='qemu' type='raw'/> > >> <source file='@abs_top_builddir@/test-data/phony-guests/blank-disk.img'/> > >> - <!-- virt-v2v should preserve the device name and bus --> > >> + <!-- virt-v2v should change the bus to sata, due to Windows 7 > >> + triggering a machine type change from i440fx to q35. Beyond that, > >> + virt-v2v should preserve the on-bus index. --> > >> <target dev='hdc' bus='ide'/> > >> </disk> > >> </devices> > >> -- > >> 2.19.1.3.g30247aa5d201 > >> > >> > >> _______________________________________________ > >> Libguestfs mailing list > >> Libguestfs at redhat.com > >> https://listman.redhat.com/mailman/listinfo/libguestfs > >-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v