From 0b1da01ef2fb0f00b8df5967e14c3dd10396680d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Thu, 20 Oct 2022 16:19:20 +0200 Subject: [PATCH] qemu: do not attempt to pass unopened vsock FD MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On normal vm startup, we open a file descriptor for the vsock device in qemuProcessPrepareHost. However, when doing domxml-to-native, no file descriptors are open. Only pass the fd if it's not -1, to make domxml-to-native work. https://bugzilla.redhat.com/show_bug.cgi?id=1777212 Signed-off-by: Ján Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 150824f2e1..bbbde57c0f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9717,7 +9717,8 @@ qemuBuildVsockCommandLine(virCommand *cmd, if (!(devprops = qemuBuildVsockDevProps(def, vsock, qemuCaps, ""))) return -1; - virCommandPassFD(cmd, priv->vhostfd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); + if (priv->vhostfd != -1) + virCommandPassFD(cmd, priv->vhostfd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); priv->vhostfd = -1; if (qemuCommandAddExtDevice(cmd, &vsock->info, def, qemuCaps) < 0) -- 2.39.5