This improves the error message when used with domxml-to-native
from:
error: internal error: invalid use of command API
https://bugzilla.redhat.com/show_bug.cgi?id=1777212
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_command.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 156af4caee..f71f867942 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10291,6 +10291,12 @@ qemuBuildVsockCommandLine(virCommand *cmd,
qemuDomainVsockPrivate *priv = (qemuDomainVsockPrivate *)vsock->privateData;
g_autofree char *devstr = NULL;
+ if (priv->vhostfd == -1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("only pre-opened file descriptors are supported for vsock
devices"));
+ return -1;
+ }
+
if (!(devstr = qemuBuildVsockDevStr(def, vsock, qemuCaps, "")))
return -1;
--
2.31.1