On Wed, Apr 13, 2016 at 07:45:42PM +0300, Roman Kagan wrote:
On Wed, Apr 13, 2016 at 10:11:54AM +0100, Richard W.M. Jones wrote:
On Tue, Apr 12, 2016 at 06:46:31PM +0300, Roman Kagan wrote:
+ (* Presence of virtio-scsi controller. *) + let has_virtio_scsi = + let obj = Xml.xpath_eval_expression xpathctx + "/domain/devices/controller[@model='virtio-scsi']" in
I guess this short cut is OK. A true test would involve checking the <target bus="scsi"> on each disk and matching it back to the controller. In other words, a huge pain! Maybe you can add an "XXX" comment in the source about this.
On a second look, I'm not sure I got your comment right.
AFAICS there's no way in libvirt xml to define multiple scsi buses,
I think this is possible, although massively unlikely in practice. I think the different controllers would have different index="0"/index="1"/... attributes.
so all the matching I can do is just to notice the presence of virtio-scsi controller, and attribute all SCSI drives to it. This is exactly what happens in the patch.
Am I missing something?
So first off I think this part of the patch and your assumption is fine, there's no need to change the code. However there is a possibility that the source guest might have multiple mixed virtio-blk + virtio-scsi disks. In that case the disks would look like this: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file=...> <target dev='vda' bus='virtio'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file=...> <target dev='sda' bus='scsi'/> </disk> <controller type="scsi" index="0" model="virtio-scsi"/> It's not something that we should worry about, and a simple comment with "XXX" in it is fine, if you agree with my analysis. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v