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
Signed-off-by: Ján Tomko <jtomko@redhat.com>
return 0;
}
-static bool
+bool
virDomainDefHasUSB(const virDomainDef *def)
{
size_t i;
unsigned int parseFlags,
virDomainXMLOptionPtr xmlopt,
void *parseOpaque);
+bool
+virDomainDefHasUSB(const virDomainDef *def);
int virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
virDomainDefHasDeviceAddress;
virDomainDefHasMemballoon;
virDomainDefHasMemoryHotplug;
+virDomainDefHasUSB;
virDomainDefHasVcpusOffline;
virDomainDefLifecycleActionAllowed;
virDomainDefMaybeAddController;
&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;
+ }
+
if (data.count > available_ports)
hubs_needed = VIR_DIV_UP(data.count - available_ports + 1,
VIR_DOMAIN_USB_HUB_PORTS - 1);