On Wed, 2017-09-20 at 16:18 +0200, Ján Tomko wrote:
> If the user tries to define a domain that has
> 
>   <controller type='usb' model='none'/>
> 
> and also some USB devices, we report an error:
>   error: internal error: No free USB ports
> 
> Which is technically still correct for a domain with no USB ports.
> 
> Change it to:
> 
> USB is disabled for this domain, but USB devices are present in the domain XML
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1347550

[...]
> @@ -2656,6 +2656,8 @@ int virDomainDefPostParse(virDomainDefPtr def,
>                            unsigned int parseFlags,
>                            virDomainXMLOptionPtr xmlopt,
>                            void *parseOpaque);
> +bool
> +virDomainDefHasUSB(const virDomainDef *def);

Have everything on a single line here.

[...]
> @@ -2644,6 +2644,13 @@ qemuDomainUSBAddressAddHubs(virDomainDefPtr def)
>                                                &data,
>                                                false));
>  
> +    if (data.count && !virDomainDefHasUSB(def)) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("USB is disabled for this domain, but USB devices "
> +                         "are present in the domain XML"));
> +        return -1;
> +    }

I would prefer 'data.count > 0' here, but your version works
fine too.


Reviewed-by: Andrea Bolognani <abolo...@redhat.com>
List-necromancy-by: Andrea Bolognani <abolo...@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

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

Reply via email to