
On 08/02/12 11:00, Jiri Denemark wrote:
On Mon, Jul 23, 2012 at 14:19:13 +0200, Peter Krempa wrote:
Libvirt adds a USB controller to the guest even if the user does not specify any in the XML. This is due to back-compat reasons.
To allow disabling USB for a guest this patch adds a new USB controller type "none" that disables USB support for the guest. --- Diff to v2: - added docs to formatdomain.hmtl - changed error reporting functions to global ones --- docs/formatdomain.html.in | 6 +++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 55 ++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 3 +- 5 files changed, 62 insertions(+), 4 deletions(-)
...
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c53722a..cf3b1c4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c ... @@ -9043,6 +9074,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (!hostdev) goto error;
+ if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB && + usb_none) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Can't add USB device passthrough: "
I think "Can't add host USB device" would better fit the name of the element.
Yep, those are indeed better than my try.
+ "USB is disabled in this host")); + goto error; + } + def->hostdevs[def->nhostdevs++] = hostdev; } VIR_FREE(nodes); ... @@ -9128,6 +9174,13 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (!redirdev) goto error;
+ if (redirdev->bus == VIR_DOMAIN_REDIRDEV_BUS_USB && usb_none) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Can't add USB redir device: "
"Can't add redirected USB device" seems better to me.
+ "USB is disabled for this domain")); + goto error; + } + def->redirdevs[def->nredirdevs++] = redirdev; } VIR_FREE(nodes); ...
ACK
Jirka
I changed the error messages to those you suggested and changed the version statement docs/formatdomain.html.in to 0.10.0 and pushed with the rest of the series. Thanks for the review! Peter