Bug 479239

Summary: RHEL4 kvm virtio: mkinitrd support booting from KVM virtio devices
Product: Red Hat Enterprise Linux 4 Reporter: Chris Lalancette <clalance>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED ERRATA QA Contact: Alexander Todorov <atodorov>
Severity: medium Docs Contact:
Priority: low    
Version: 4.8CC: ajia, atodorov, borgan, ddumas, markmc, pcfe
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 20:30:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 446215    
Attachments:
Description Flags
Patch to correctly pull in virtio_pci when the boot device is virtio_blk
none
Cleaned up patch none

Description Chris Lalancette 2009-01-08 09:09:08 UTC
If you run kvm-qemu with e.g. --drive if=virtio,boot=on,file=foo.img then the
guest must use the KVM virtio drivers to mount the root device.

KVM exposes its virtio devices to the guest over PCI, requiring the guest to use
the virtio_pci driver for device enumeration. The actual block device driver is
virtio_blk.

Currently, if you boot using virtio and then try and create new initrd, the
initrd will include virtio_blk, but not virtio_net.

virtio_blk is to virtio_pci as standard disk drives is to the core PCI code, and
as virtio_blk is to lguest's device enumeration code and as xen_blkfront is to
xenbus.

Where virtio_pci differs from the others, though, is that it's a module and not
built in.

Comment 1 Chris Lalancette 2009-01-08 09:09:47 UTC
Created attachment 328451 [details]
Patch to correctly pull in virtio_pci when the boot device is virtio_blk

Comment 2 Hans de Goede 2009-01-13 08:57:00 UTC
Created attachment 328848 [details]
Cleaned up patch

We already have a list of modules with special deps in find module, so it seems cleaner to put it there.

Comment 3 Peter Jones 2009-01-13 15:31:26 UTC
Fixed in mkinitrd-4.2.1.13-4 .

Comment 5 Alexander Todorov 2009-02-11 10:16:57 UTC
Install PASSed with :
# qemu-kvm -drive file=/root/kvm.img,if=virtio,boot=on -net nic,model=virtio,macaddr=00:16:41:E4:1D:FF,vlan=0 -net tap,script=/etc/qemu-ifup,vlan=0,ifname=vnet0 -m 512 -cdrom /root/boot.iso -boot d

Boot FAILED with:
# qemu-kvm -drive file=/root/kvm.img,if=virtio,boot=on -net nic,model=virtio,macaddr=00:16:41:E4:1D:FF,vlan=0 -net tap,script=/etc/qemu-ifup,vlan=0,ifname=vnet0 -m 512

lsmod | grep virtio in rescue mode shows: (looks ok)
virtio_blk 8137 3 - Live 0xe081f000
virtio_net 10945 0 - Live 0xe08a9000
virtio_pci 8385 0 - Live 0xe08a5000
virtio 5445 3 virtio_blk,virtio_net,virtio_pci, Live 0xe0866000
virtio_ring 4033 1 virtio_pci, Live 0xe0864000

zcat /boot/initrd-$(version).img | cpio -t | grep virtio in rescue mode shows:
lib/virtio.ko
lib/virtio_blk.ko


while in RHEL 5 we had (see bug #446232 comment #17):
# zcat /boot/initrd-2.6.18-122.el5.img | cpio -t | grep virtio
16057 blocks
lib/virtio_pci.ko
lib/virtio_blk.ko
lib/virtio.ko
lib/virtio_ring.ko

This is with mkinitrd-4.2.1.13-1

Comment 6 Alexander Todorov 2009-02-11 10:37:02 UTC
With mkinitrd-4.2.1.13-4 (latest nightly)

# zcat /boot/initrd-2.6.9-80.EL.img | cpio -t | grep virtio
lib/virtio.ko
lib/virtio_blk.ko
lib/virtio_ring.ko
lib/virtio_pci.ko

moving to VERIFIED

Comment 8 errata-xmlrpc 2009-05-18 20:30:01 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1008.html