Description of problem: if I start 2 guests with same xml except the domain name, also have same attached device <disk type='block' device='lun'> <driver name='qemu' type='raw'/> <source dev='/dev/sdb'/> <target dev='vdb' bus='virtio'/> <shareable/> </disk> when do attach-device on one guest 2 times with xml <disk type='block' device='lun' sgio='unfiltered'> <driver name='qemu' type='raw'/> <source dev='/dev/sdb'/> <shareable/> <target dev='vdc' bus='virtio'/> </disk> disk can be attached successfully, and after restart libvirtd, the first started guest will be destroyed without any error on libvirtd.log Version-Release number of selected component (if applicable): libvirt-0.10.2-18.el6_4.2.x86_64 qemu-kvm-rhev-0.12.1.2-2.355.el6_4.2.x86_64 kernel-2.6.32-358.2.1.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1. Define and start 2 guests with same xml except name and uuid, also with same attached disk <disk type='block' device='lun'> <driver name='qemu' type='raw'/> <source dev='/dev/sdb'/> <target dev='vdb' bus='virtio'/> <shareable/> </disk> # virsh define tt2.xml # virsh define tt3.xml # virsh start tt2 # virsh start tt3 2. Attach-device with xml <disk type='block' device='lun' sgio='unfiltered'> <driver name='qemu' type='raw'/> <source dev='/dev/sdb'/> <shareable/> <target dev='vdc' bus='virtio'/> </disk> two times and first time it will report error and second time it will succeed # virsh attach-device tt3 virtio-block-disk.xml error: Failed to attach device from virtio-block-disk.xml error: Requested operation is not valid: sgio of shared disk '/dev/sdb' conflicts with other active domains # virsh attach-device tt3 virtio-block-disk.xml Device attached successfully 3. Restart libvirtd service Actual results: tt2 is destroyed with out any error on libvirtd.log Expected results: attach-device should always have error Additional info:
(In reply to comment #0) > Description of problem: > if I start 2 guests with same xml except the domain name, also have same > attached device > <disk type='block' device='lun'> > <driver name='qemu' type='raw'/> > <source dev='/dev/sdb'/> > <target dev='vdb' bus='virtio'/> > <shareable/> > </disk> > > when do attach-device on one guest 2 times with xml > <disk type='block' device='lun' sgio='unfiltered'> > <driver name='qemu' type='raw'/> > <source dev='/dev/sdb'/> > <shareable/> > <target dev='vdc' bus='virtio'/> > </disk> > > disk can be attached successfully, and after restart libvirtd, the first > started guest will be destroyed without any error on libvirtd.log > Confirmed with Daniel, using same disk source for 2 disks of a same domain is just wrong use. The only problem left is we might need to prohibit the user going the wrong way.
Moved to "Virtualization Component", since it's a wrong use, I don't think one will use same disk source for multiple disks in a domain in practice, and we still need to figure out in upstream if needs to prohibit the wrong use.
The original report of attach-device succeeding after the second attempt no longer works for me: [root@localhost ~]# sudo virsh attach-device sgio-2 disk.xml error: Failed to attach device from disk.xml error: Requested operation is not valid: sgio of shared disk '/dev/vdb' conflicts with other active domains [root@localhost ~]# sudo virsh attach-device sgio-2 disk.xml error: Failed to attach device from disk.xml error: Requested operation is not valid: sgio of shared disk '/dev/vdb' conflicts with other active domains So I suspect this was fixed at some point