Tweak USB hostdevice XML handling

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
This commit is contained in:
Daniel P. Berrange 2010-02-01 17:21:05 +00:00
parent 719c50caf8
commit 23d6abd23b
2 changed files with 9 additions and 3 deletions

View File

@ -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"/>

View File

@ -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,