
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
[...]
@@ -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 <abologna@redhat.com> List-necromancy-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization