[libvirt] [PATCH 13/13] Tweak USB hostdevice XML handling
Daniel Veillard
veillard at redhat.com
Tue Feb 2 15:03:52 UTC 2010
On Mon, Feb 01, 2010 at 06:39:42PM +0000, Daniel P. Berrange wrote:
> When attaching a USB host device based on vendor/product, libvirt
> will resolve the vendor/product into a device/bus pair. This means
> that when printing XML we should allow device/bus info to be printed
> at any time if present
>
> * src/conf/domain_conf.c, docs/schemas/domain.rng: Allow USB device
> bus info alongside vendor/product
> ---
> docs/schemas/domain.rng | 7 ++++++-
> src/conf/domain_conf.c | 5 +++--
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
> index 827ff6f..bb6d00d 100644
> --- a/docs/schemas/domain.rng
> +++ b/docs/schemas/domain.rng
> @@ -1179,7 +1179,12 @@
> <group>
> <element name="source">
> <choice>
> - <ref name="usbproduct"/>
> + <group>
> + <ref name="usbproduct"/>
> + <optional>
> + <ref name="usbaddress"/>
> + </optional>
> + </group>
> <ref name="usbaddress"/>
> <element name="address">
> <ref name="pciaddress"/>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b434fc5..766993c 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5244,11 +5244,12 @@ virDomainHostdevDefFormat(virConnectPtr conn,
> def->source.subsys.u.usb.vendor);
> virBufferVSprintf(buf, " <product id='0x%.4x'/>\n",
> def->source.subsys.u.usb.product);
> - } else {
> + }
> + if (def->source.subsys.u.usb.bus ||
> + def->source.subsys.u.usb.device)
> virBufferVSprintf(buf, " <address bus='%d' device='%d'/>\n",
> def->source.subsys.u.usb.bus,
> def->source.subsys.u.usb.device);
> - }
> } else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
> virBufferVSprintf(buf, " <address domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n",
> def->source.subsys.u.pci.domain,
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list