Bug 479134 - RHEL4 kvm virtio: anaconda support for installing to kvm virtio guests
RHEL4 kvm virtio: anaconda support for installing to kvm virtio guests
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: anaconda (Show other bugs)
4.8
All Linux
low Severity medium
: rc
: ---
Assigned To: Hans de Goede
Alexander Todorov
:
Depends On:
Blocks: 446215
  Show dependency treegraph
 
Reported: 2009-01-07 09:26 EST by Chris Lalancette
Modified: 2009-05-18 16:17 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-18 16:17:06 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch 1/7, Add virtio support to devMakeInode (2.37 KB, patch)
2009-01-07 09:27 EST, Chris Lalancette
no flags Details | Diff
Patch 2/7, Add virtio to module info (439 bytes, patch)
2009-01-07 09:28 EST, Chris Lalancette
no flags Details | Diff
Patch 3/7, Explicitly include virtio_pci in the initrd (1.56 KB, patch)
2009-01-07 09:29 EST, Chris Lalancette
no flags Details | Diff
Patch 4/7, Probe on BUS_VIRTIO for devices (659 bytes, patch)
2009-01-07 09:29 EST, Chris Lalancette
no flags Details | Diff
Patch 5/7, Sort virtio devices first (564 bytes, patch)
2009-01-07 09:30 EST, Chris Lalancette
no flags Details | Diff
Patch 6/7, Add virtio max partition count (368 bytes, patch)
2009-01-07 09:30 EST, Chris Lalancette
no flags Details | Diff
Patch 7/7, Probe BUS_VIRTIO again after probing BUS_PCI (2.34 KB, patch)
2009-01-07 09:31 EST, Chris Lalancette
no flags Details | Diff
Patch 1/6, Add virtio support to devMakeInode (2.32 KB, patch)
2009-01-12 09:47 EST, Chris Lalancette
no flags Details | Diff
Patch 2/6, Add virtio to module info (453 bytes, patch)
2009-01-12 09:48 EST, Chris Lalancette
no flags Details | Diff
Patch 3/6, Explicitly include virtio_pci in the initrd (1.59 KB, patch)
2009-01-12 09:48 EST, Chris Lalancette
no flags Details | Diff
Patch 4/6, Sort virtio devices first (578 bytes, patch)
2009-01-12 09:49 EST, Chris Lalancette
no flags Details | Diff
Patch 5/6, Add virtio max partition count (382 bytes, patch)
2009-01-12 09:50 EST, Chris Lalancette
no flags Details | Diff
Patch 6/6, Probe BUS_VIRTIO again after probing BUS_PCI (1.78 KB, patch)
2009-01-12 09:50 EST, Chris Lalancette
no flags Details | Diff

  None (edit)
Description Chris Lalancette 2009-01-07 09:26:32 EST
anaconda needs a series of patches in order to support installing to kvm virtio
guests.

These patches pretty closely mirror how F-9 supports virtio, with the exception
of the devMakeInode() patch isn't needed in F-9 since ananconda uses udev there.
The nasty thing about this patch is that virtio_blk hasn't yet been assigned a
major number, so we need to poke in /proc/devices for it.

Note: these patches are untested at yet, so they're for illustration only atm.
Comment 1 Chris Lalancette 2009-01-07 09:27:29 EST
Created attachment 328383 [details]
Patch 1/7, Add virtio support to devMakeInode
Comment 2 Chris Lalancette 2009-01-07 09:28:02 EST
Created attachment 328384 [details]
Patch 2/7, Add virtio to module info
Comment 3 Chris Lalancette 2009-01-07 09:29:11 EST
Created attachment 328385 [details]
Patch 3/7, Explicitly include virtio_pci in the initrd
Comment 4 Chris Lalancette 2009-01-07 09:29:51 EST
Created attachment 328386 [details]
Patch 4/7, Probe on BUS_VIRTIO for devices
Comment 5 Chris Lalancette 2009-01-07 09:30:22 EST
Created attachment 328387 [details]
Patch 5/7, Sort virtio devices first
Comment 6 Chris Lalancette 2009-01-07 09:30:53 EST
Created attachment 328388 [details]
Patch 6/7, Add virtio max partition count
Comment 7 Chris Lalancette 2009-01-07 09:31:33 EST
Created attachment 328389 [details]
Patch 7/7, Probe BUS_VIRTIO again after probing BUS_PCI
Comment 8 Chris Lalancette 2009-01-12 05:54:30 EST
OK, I've now tested this out, and it *mostly* works.  There is a bug remaining, but I'm not sure if it is in my patches or if it is in anaconda itself.  Basically, if I try to do an install to a guest where the hard drive is backed by a completely blank file (that is, all zeros), I get a traceback during pvcreate saying that the requested /dev device doesn't exist.  This, in turn, seems to happen because after partitioning the device, the kernel isn't being told to refresh it's view of the partitions.  That is, at the time of the error, /proc/partitions contains:

 253    0    10485760 vda

When it really should contain:

 253    0    10485760 vda
 253    1      102348 vda1
 253    2    10383360 vda2

The thing is, the partition table is already on disk, as evidenced by fdisk -l /dev/vda:

Disk /dev/vda: 10.7 GB, 10737418240 bytes
4 heads, 32 sectors/track, 163840 cylinders
Units = cylinders of 128 * 512 = 65536 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1        1600      102384   83  Linux
/dev/vda2            1601      163840    10383360   8e  Linux LVM

So it just seems like the ioctl() to re-read the partition table isn't happening.  Again, I'm not sure if that is a bug in my code (am I supposed to do that manually?), or if it something anaconda should be doing regardless.  In any caes, working around this (by manually partitioning the device first) allows me to do a full install, so other than this issue these patches are ready to go.

Chris Lalancette
Comment 9 Hans de Goede 2009-01-12 06:33:08 EST
(In reply to comment #8)

<snip>

> So it just seems like the ioctl() to re-read the partition table isn't
> happening.  Again, I'm not sure if that is a bug in my code (am I supposed to
> do that manually?), or if it something anaconda should be doing regardless.  In
> any caes, working around this (by manually partitioning the device first)
> allows me to do a full install, so other than this issue these patches are
> ready to go.

Thanks for the testing.

About the issue you are seeing that is an issue with parted as is in RHEL-4.

If you look at the parted sources and then at libparted/linux.c: 323 and further
(the _device_probe_type() function), then you will see it sets the device type to PED_DEVICE_FILE for unknown devices like virtio disks, if you then look at 
linux_disk_commit() (line 1853 and further) you will see it will not do the ioctl if the type is PED_DEVICE_FILE. 

Fedora doesn't have this problem because the _device_probe_type() function sets the type to PED_DEVICE_UNKNOWN when it cannot find out what the type is, so it will still call the ioctl.




> Chris Lalancette
Comment 10 Chris Lalancette 2009-01-12 09:47:03 EST
Created attachment 328743 [details]
Patch 1/6, Add virtio support to devMakeInode
Comment 11 Chris Lalancette 2009-01-12 09:48:13 EST
Created attachment 328744 [details]
Patch 2/6, Add virtio to module info
Comment 12 Chris Lalancette 2009-01-12 09:48:45 EST
Created attachment 328745 [details]
Patch 3/6, Explicitly include virtio_pci in the initrd
Comment 13 Chris Lalancette 2009-01-12 09:49:30 EST
Created attachment 328746 [details]
Patch 4/6, Sort virtio devices first
Comment 14 Chris Lalancette 2009-01-12 09:50:06 EST
Created attachment 328747 [details]
Patch 5/6, Add virtio max partition count
Comment 15 Chris Lalancette 2009-01-12 09:50:45 EST
Created attachment 328748 [details]
Patch 6/6, Probe BUS_VIRTIO again after probing BUS_PCI
Comment 16 Chris Lalancette 2009-01-12 09:54:42 EST
OK, new patch series.  As suggested by Hans, I dropped Patch 4/7 and made the probeVirtio unconditional in Patch 7/7.  This makes it a little more clear, and makes this new series only have 6 patches instead of the previous 7.

Also as suggested by Hans, the problem with not updating the kernel's partition tables was indeed a problem in parted.  I created a patch for parted (BZ 479678), and with that in place, along with this new anaconda patch series, I was able to successfully install a RHEL-4 guest on a series of virtio disks (even blank ones).

Chris Lalancette
Comment 17 Hans de Goede 2009-01-13 08:16:17 EST
Thanks,

All patches committed now, changing status to modified.
Comment 18 RHEL Product and Program Management 2009-01-15 07:20:53 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 20 Alexander Todorov 2009-02-11 05:09:47 EST
Install 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

Default partitioning, default package set - PASS.

lsmod | grep virtio in rescue mode shows:

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


The system was not able to boot but I believe this is due to bug in mkinitrd. See bug 479239 for the mkinitrd part. I'm moving this to VERIFIED.
Comment 22 errata-xmlrpc 2009-05-18 16:17:06 EDT
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-0978.html

Note You need to log in before you can comment on or make changes to this bug.