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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

Thanks,
Cole

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]