
On Thu, Jun 09, 2016 at 17:02:42 +0200, Michal Privoznik wrote:
This is really simple, we just need to append the device into the domain def and that's it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_driver.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d7b65f1..0baf2c8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c
[...]
@@ -7909,6 +7910,14 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, dev->data.memory = NULL; break;
+ case VIR_DOMAIN_DEVICE_REDIRDEV: + redirdev = dev->data.redirdev; +
You need to check here that the VM has USB controllers defined. Otherwise loading of the resulting XML file will fail as there's a check in the parser.
+ if (VIR_APPEND_ELEMENT(vmdef->redirdevs, vmdef->nredirdevs, redirdev) < 0) + return -1; + dev->data.redirdev = NULL; + break;