[libvirt] [PATCH] Don't validate disk type in virsh attach-disk

Daniel P. Berrange berrange at redhat.com
Mon Mar 2 16:29:06 UTC 2009


On Mon, Mar 02, 2009 at 05:06:48PM +0100, 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.

IMHO, the new diagnostic is correct, because the test driver does not
support *any* hotplug whatsoever. Thus there is no concept of a particular
type being bogus for the test driver - floppy, cdrom, disk, bogus, they're
all equally unsupported by the test driver, since it has no hotplug 
support, which is what the new error message shows more clearly.

Regards,
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 :|




More information about the libvir-list mailing list