Qemu:我可以在虚拟SCSI设备上设置序列号吗?

我在Ubuntu 11.04上使用libvirt + KVM + Qemu。 我有一些像这样的scsi设备:

<disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/shared-01-02-00.img'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> 

显示在虚拟机中,例如/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0

为了我的pipe理目的,我希望能够为虚拟设备分配一个任意的“序列号”,当在虚拟机内部的块设备上运行scsi_id时将显示这些序列号。 我怎样才能做到这一点?

我查阅了libvirt文档 ,发现这个:

串行
如果存在,则指定虚拟硬盘驱动器的序列号。 例如,它可能看起来像WD-WMAP9A966149。

所以你上面的XML块会变成:

 <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/shared-01-02-00.img'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' unit='0'/> <serial>some-arbitrary-serial</serial> </disk>