
On Mon, Mar 02, 2009 at 11:18:24AM -0500, Cole Robinson wrote:
Jim Meyering wrote:
Cole Robinson wrote:
virsh attempts to validate the requested disk type, rather than just let the underlying driver do it. This was erroneously denying floppy device attaches. Patch attached.
Hi Cole, Your patch would do the job. Before:
$ virsh -c test:///default attach-disk 1 s t --type floppy --mode readonly error: No support floppy in command 'attach-disk'
with the patch:
$ virsh -c test:///default attach-disk 1 s t --type floppy --mode readonly error: this function is not supported by the hypervisor: virDomainAttachDevice
But consider what happens with e.g., "--type bogus". Before, it'd mention the invalid type, "bogus". With the patch, it doesn't (at least not using the test driver). So maybe it'd be better to keep the up-front type check.
The idea here is that virsh isn't the one to decide. It could very well be that driver foo doesn't support cdrom devices, so even though virsh lets it through, it's still not valid. Only AttachDevice can give us the full picture.
Sounds like we should just implement AttachDevice for the test driver: it could parse the device xml and unconditionally insert it into the guest config. This would certainly be useful in testing the above virsh commands (and for testing device attaches in virt-manager, among others no doubt).
I concurr - the test driver should support all possible APIs and XML element options that we have available - the more the better. 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 :|