From: Ján Tomko Date: Tue, 16 Dec 2014 15:29:00 +0000 (+0100) Subject: Fix error message on redirdev caps detection X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=952f8a739492ba96db5fbd5c992c162a02e669c8;p=libvirt.git Fix error message on redirdev caps detection --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 53d662906b..11e7cffb95 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9512,8 +9512,12 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, devstr); VIR_FREE(devstr); - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("redirected devices are not supported by this QEMU")); goto error; + } + virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, qemuCaps))) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 5b65283aa2..21e9713099 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1358,13 +1358,17 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, virDomainDefPtr def = vm->def; char *devstr = NULL; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - if (qemuAssignDeviceRedirdevAlias(vm->def, redirdev, -1) < 0) - goto error; - if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps))) - goto error; + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("redirected devices are not supported by this QEMU")); + goto error; } + if (qemuAssignDeviceRedirdevAlias(vm->def, redirdev, -1) < 0) + goto error; + if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps))) + goto error; + if (VIR_REALLOC_N(vm->def->redirdevs, vm->def->nredirdevs+1) < 0) goto error;