tunnel; <code>type='tcp'</code>
or <code>type='spicevmc'</code> (which uses the usbredir
channel of a <a href="#elementsGraphics">SPICE graphics
- device</a>) are typical. Further sub-elements, such
- as <code><source></code>, may be required according to
- the given type, although a <code><target></code>
- sub-element is not required (since the consumer of the
- character device is the hypervisor itself, rather than a
- device visible in the guest).</dd>
+ device</a>) are typical.</dd>
</dl>
+ <p>
+ The redirdev element has an optional sub-element
+ <code><address></code> which can tie the device to a
+ particular controller.
+ </p>
+ <p>
+ Further sub-elements, such as <code><source></code>, may
+ be required according to the given type, although
+ a <code><target></code> sub-element is not required (since
+ the consumer of the character device is the hypervisor itself,
+ rather than a device visible in the guest).
+ </p>
<h4><a name="elementsSmartcard">Smartcard devices</a></h4>
<ref name="qemucdevSrcTypeChoice"/>
</attribute>
<ref name="qemucdevSrcDef"/>
+ <optional>
+ <ref name="address"/>
+ </optional>
</element>
</define>
<define name="hostdev">
def->source.chr.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR;
}
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
+ goto error;
+
+ if (def->bus == VIR_DOMAIN_REDIRDEV_BUS_USB &&
+ def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+ def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Invalid address for a USB device"));
+ goto error;
+ }
+
+
cleanup:
VIR_FREE(bus);
VIR_FREE(type);
virBufferAsprintf(buf, " <redirdev bus='%s'", bus);
if (virDomainChrSourceDefFormat(buf, &def->source.chr, false, flags) < 0)
return -1;
+ if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
+ return -1;
virBufferAddLit(buf, " </redirdev>\n");
return 0;
-chardev socket,id=charredir0,host=localhost,port=4000 \
-device usb-redir,chardev=charredir0,id=redir0 \
-chardev spicevmc,id=charredir1,name=usbredir \
--device usb-redir,chardev=charredir1,id=redir1 \
+-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,multifunction=on,addr=0x3.0x0
<protocol type='raw'/>
</redirdev>
<redirdev bus='usb' type='spicevmc'>
+ <address type='usb' bus='0' port='4'/>
</redirdev>
<memballoon model='virtio'/>
</devices>