
On 03/11/2012 08:44 AM, Paolo Bonzini wrote:
Il 05/03/2012 11:25, Osier Yang ha scritto:
This is similiar with physical world, one will be surprised if the box starts with medium exists while the tray is open.
New tests are added, tests disk-{cdrom,floppy}-tray are for the qemu supports "-device" flag, and disk-{cdrom,floppy}-no-device-cap are for old qemu, i.e. which doesn't support "-device" flag.
If the disk type is "block", and the source drive is a CD-ROM, the virtual tray state should be tied to the physical tray, even though this isn't always the case due to QEMU bugs.
Perhaps you should fail creation if the tray attribute is "open" in the above circumstances. Another possibility is to forbid specifying the tray attribute completely.
Or you can just drop this patch, and only print the tray state in the virsh dumpxml output. There are other attributes that already handled this way.
Are we trying to map the tray='open' to what the guest sees (in which case, we should reject it for non-cdrom guest views), what the host sees (even if the guest is viewing the storage as a non-cdrom IDE disk, but the host storage backing that disk is a cdrom), or both? I would argue that <target tray='open'/> should describe _only_ the guest's view, regardless of host state (if host is even tying a physical cdrom to the guest), and that if we _need_ the host state, that it should be an optional element in <source>. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org