On Tue, Aug 21, 2012 at 11:49:04AM +0100, Matthew Booth wrote:
>(3) The "serial numbers" option
>
>This was Dan's suggestion. Hotplugged drives are known only by their
>serial number. ie. We hotplug them via libvirt using the <serial/>
>field, and then they are accessed using /dev/disk/by-id/serial.
>
>This is tempting, but unfortunately it doesn't quite work in stock
>udev, because the actual name used is:
>
> /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_SERIAL
>
>We could add a custom udev rule to get the path we wanted.
Presumably you would specify then serial number when adding the
drive? I'm not opposed to this, but it's not the simplest.
That's right, possibly reusing the name field for this purpose.
>(4) The "rewriting device names" option
>
>Since we already have the infrastructure to rewrite device names, we
>could do some complicated and hairy device name rewriting to make
>names appear continguous, even though there's an hidden appliance
>drive.
>
>This is my least favourite option, mainly because of the complexity,
>and complexity is bound to lead to bugs.
I don't think this rewriting is required. Having a hole in the drive
letters isn't a big deal. In fact, I suspect it would be simpler in
most code to use returned rather than calculated device names.
I'd suggest a very simple api:
char * guestfs_hotplug_drive(g, path, <opts>)
This does the same as add_drive, except that it works after launch
and returns the api name of the newly added drive. list_devices will
return a list with a hole in it. If it isn't already there, we can
add some generic code to methods taking a Device parameter to guard
against passing in the root device.
I looked at this and thought it might be tricky to implement. ie. The
implementation would be:
- (library) add the drive via libvirt with a generated serial
- (appliance) query the appliance to find out the new device name
If so, then it would essentially reduce to the serial option, but
hiding the serial number.
Any simpler way to implement this?
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