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.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://et.redhat.com/~rjones/libguestfs/
See what it can do:
http://et.redhat.com/~rjones/libguestfs/recipes.html