The following set of patches changes libguestfs to use virtio block devices by default.
Device names change from /dev/sd* to /dev/vd*, but device name translation should hide this change in most cases:
http://libguestfs.org/guestfs.3.html#block_device_naming
The change isn't totally straightforward. The CHS for virtio disks is different from the CHS for IDE disks (even where the disks have identical size). These caused sfdisk with explicit cylinder numbers to fail, so I had to change all these. This is the reasoning behind patch 2 and most of patch 3.
Patch 1: Just changes the way some messages are displayed from the test suite.
Patch 2: Changes the statvfs test so it doesn't get affected by the CHS change.
Patch 3: (a) We change the list-devices and list-partitions functions so that they see and return /dev/vd* devices. (b) The udev fix previously posted to this list. (c) Change the partition sizes because of the CHS change - see above. (d) Add ,if=virtio to -drive parameters so that block devices are exported as virtio disks.
Patch 4: The generated code, just shown for completeness.
The tests all pass except one. A single test fails because pvremove from the previous test causes sfdisk to fail (apparently the previous pvremove is still happening, so sfdisk refuses to partition the device because it is in use). I believe this is an underlying failure revealed by this change to virtio, not caused by the change itself.
There doesn't appear to be any noticable increase in speed when running the tests, but I didn't measure anything. The main reason to use virtio is that it's inherently simpler than emulating IDE or SCSI devices.
Rich.
On Tue, Jun 30, 2009 at 03:51:23PM +0100, Richard W.M. Jones wrote:
The following set of patches changes libguestfs to use virtio block devices by default.
I pushed this one.
One test fails - I'm about to file a bug about that.
Rich.
On Wed, Jul 01, 2009 at 04:16:18PM +0100, Richard W.M. Jones wrote:
One test fails - I'm about to file a bug about that.
https://bugzilla.redhat.com/show_bug.cgi?id=509155
Rich.