Matthew Booth
2010-May-13 13:34 UTC
[Libguestfs] [PATCH] Fix import of RHEL 3 kvm guests using kmod-virtio
RHEL 3 doesn't have a dynamic /dev. kmod-virtio creates devices nodes for vdX block devices based on what the major number of virtblk was at the time it was installed. This is, in turn, based on the order the modules were loaded in initrd. To try to preserve this precarious state of affairs, when adding virtio drivers to a new initrd we always load the same drivers as kmod-virtio in the same order. --- lib/Sys/VirtV2V/Converter/Linux.pm | 8 +++++++- lib/Sys/VirtV2V/GuestOS/RedHat.pm | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/Sys/VirtV2V/Converter/Linux.pm b/lib/Sys/VirtV2V/Converter/Linux.pm index df7c969..6c50cd1 100644 --- a/lib/Sys/VirtV2V/Converter/Linux.pm +++ b/lib/Sys/VirtV2V/Converter/Linux.pm @@ -332,7 +332,13 @@ sub _configure_boot my ($guestos, $kernel, $virtio) = @_; if($virtio) { - $guestos->prepare_bootable($kernel, "virtio_pci", "virtio_blk"); + # The order of modules here is deliberately the same as the order + # specified in the postinstall script of kmod-virtio in RHEL3. The + # reason is that the probing order determines the major number of vdX + # block devices. If we change it, RHEL 3 KVM guests won't boot. + $guestos->prepare_bootable($kernel, "virtio", "virtio_ring", + "virtio_blk", "virtio_net", + "virtio_pci"); } else { $guestos->prepare_bootable($kernel, "sym53c8xx"); } diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm index 8b211f0..af64dfa 100644 --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm @@ -1381,10 +1381,10 @@ sub prepare_bootable # Backup the original initrd $g->mv("$initrd", "$initrd.pre-v2v"); - # Create a new initrd which preloads the required kernel modules - my @preload_args = (); + # Create a new initrd which probes the required kernel modules + my @module_args = (); foreach my $module (@modules) { - push(@preload_args, "--preload=$module"); + push(@module_args, "--with=$module"); } # mkinitrd reads configuration which we've probably changed @@ -1407,7 +1407,7 @@ sub prepare_bootable $g->modprobe("loop"); }; - $g->command(["/sbin/mkinitrd", @preload_args, $initrd, $version]); + $g->command(["/sbin/mkinitrd", @module_args, $initrd, $version]); } # Disable kudzu in the guest -- 1.6.6.1
Richard W.M. Jones
2010-May-13 14:15 UTC
[Libguestfs] [PATCH] Fix import of RHEL 3 kvm guests using kmod-virtio
On Thu, May 13, 2010 at 02:34:15PM +0100, Matthew Booth wrote:> RHEL 3 doesn't have a dynamic /dev. kmod-virtio creates devices nodes for vdX > block devices based on what the major number of virtblk was at the time it was > installed. This is, in turn, based on the order the modules were loaded in > initrd. > > To try to preserve this precarious state of affairs, when adding virtio drivers > to a new initrd we always load the same drivers as kmod-virtio in the same > order.Scary ... ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
Seemingly Similar Threads
- [PATCH] Fix mkinitrd detection of LVM root on RHEL 4
- [PATCH 1/2] Try to load the loop module before running mkinitrd
- [PATCH] Converter: Explicitly preload sym53c8xx when running mkinitrd
- [PATCH 1/2] Fix remapping of block devices
- [PATCH] Converter: Update xvc0 console to ttyS0