On Mon, Aug 17, 2009 at 02:37:48PM -0400, Dave Allan wrote:
Daniel P. Berrange wrote:
>All hard disks (IDE, SCSI, USB, VirtIO) have a concept of a serial number
>which is intended to uniquely identify them. If you mean this off, QEMU
>just makes up a serial on the fly. THis is not guarenteed to be stable
>across guest reboots with hardware changes. It is thus desirable to be
>able to specify this in libvirt XML. To that end, this patch allows
>for a <serial> element inside a disk
>
> <disk type='file' device='disk'>
> <source
> file='/media/lacie-500-disk-2/virtual-machines/scratch5.img'/>
> <target dev='vda' bus='virtio'/>
> <serial>dan123virtio</serial>
> </disk>
>
>the contents is free-form. It implemenmts this for the QEMU driver for
>any disk using -drive style args. Unfortunately this excludes USB disk,
>even though internally QEMU can set a serial for these, the -usbdevice
>syntax does not allow it
>
>Daniel
>
>* docs/schemas/domain.rng: Add <serial> element to disks
>* src/domain_conf.h, src/domain_conf.c: XML parsing and
> formatting for disk serial numbers
>* src/qemu_conf.c: Set serial number when launching guests
>* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args,
> tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml: Add
> serial number to XML test
[snip]
This patch seems like a very good idea to me. I'm surprised it
doesn't
cause more grief if the serial # keeps changing. I didn't review the
code too closely, but a definite ACK to the functionality, and I saw no
problems with the implementation in the quick look I took.
Well it causes grief for Windows guests with WHQL'd virtio drivers I
believe. We've probably just been fortunate with Linux guests that not
much functional stuff is based off the serial number. The serial number
is used for /dev/disk/by-id symlinks, but most distros use /dev/disk/by-uuid
symlinks for mounting volume instead and that's based off a filesystem
level UUID, instead of block device level serial.
As a possible additional feature, in the case of an entire device
being
assigned to the guest, have you considered passing through the serial of
the underlying device? The serial is available in the nodedev XML.
That's a policy decision, and so not within scope of libvirt. Of course
the application provisioning a new guest can see the host device's
serial, and copy that across to the guest XML it uses if desired.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|