On 10.06.2016 10:57, Peter Krempa wrote: > 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@xxxxxxxxxx> >> --- >> 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. I don't think I need to. I mean, qemuDomainAttachDeviceConfig() is called only from qemuDomainAttachDeviceFlags(). Here, user given XML is parsed by virDomainDeviceDefParse() which at its very end calls virDomainDeviceDefValidate() which in turn calls virDomainDeviceDefValidateInternal(). That brings us to patch 02/09 where I'm changing virDomainDeviceDefValidateInternal() so that it validates redirdevs too. Or have I missed something? Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list