9c6c51
From bce02fd2af85630615cc0c46d64db7b7e1023171 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <bce02fd2af85630615cc0c46d64db7b7e1023171@dist-git>
9c6c51
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
9c6c51
Date: Fri, 6 Jul 2018 15:46:58 +0100
9c6c51
Subject: [PATCH] qemu: don't use chardev FD passing with standalone args
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1598281
9c6c51
9c6c51
When using domxml-to-native, we must generate CLI args that can be used
9c6c51
in a standalone scenario. This means no FD passing can be used. To
9c6c51
achieve this we must clear the QEMU_CAPS_CHARDEV_FD_PASS capability bit.
9c6c51
9c6c51
Reviewed-by: John Ferlan <jferlan@redhat.com>
9c6c51
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9c6c51
(cherry picked from commit 7ac08cc929dc512e8682fbfcc5d33518058f20e4)
9c6c51
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_process.c | 5 +++++
9c6c51
 src/qemu/qemu_process.h | 2 ++
9c6c51
 2 files changed, 7 insertions(+)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
9c6c51
index ac32dafcbe..40d35cbe6b 100644
9c6c51
--- a/src/qemu/qemu_process.c
9c6c51
+++ b/src/qemu/qemu_process.c
9c6c51
@@ -5124,6 +5124,9 @@ qemuProcessInit(virQEMUDriverPtr driver,
9c6c51
                                                       vm->def->os.machine)))
9c6c51
         goto cleanup;
9c6c51
 
9c6c51
+    if (flags & VIR_QEMU_PROCESS_START_STANDALONE)
9c6c51
+        virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS);
9c6c51
+
9c6c51
     if (qemuDomainUpdateCPU(vm, updatedCPU, &origCPU) < 0)
9c6c51
         goto cleanup;
9c6c51
 
9c6c51
@@ -6632,6 +6635,8 @@ qemuProcessCreatePretendCmd(virQEMUDriverPtr driver,
9c6c51
 
9c6c51
     flags |= VIR_QEMU_PROCESS_START_PRETEND;
9c6c51
     flags |= VIR_QEMU_PROCESS_START_NEW;
9c6c51
+    if (standalone)
9c6c51
+        flags |= VIR_QEMU_PROCESS_START_STANDALONE;
9c6c51
 
9c6c51
     if (qemuProcessInit(driver, vm, NULL, QEMU_ASYNC_JOB_NONE,
9c6c51
                         !!migrateURI, flags) < 0)
9c6c51
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
9c6c51
index 531c2a0cc7..07ce3a9915 100644
9c6c51
--- a/src/qemu/qemu_process.h
9c6c51
+++ b/src/qemu/qemu_process.h
9c6c51
@@ -81,6 +81,8 @@ typedef enum {
9c6c51
     VIR_QEMU_PROCESS_START_PRETEND      = 1 << 3,
9c6c51
     VIR_QEMU_PROCESS_START_NEW          = 1 << 4, /* internal, new VM is starting */
9c6c51
     VIR_QEMU_PROCESS_START_GEN_VMID     = 1 << 5, /* Generate a new VMID */
9c6c51
+    VIR_QEMU_PROCESS_START_STANDALONE   = 1 << 6, /* Require CLI args to be usable standalone,
9c6c51
+                                                     ie no FD passing and the like */
9c6c51
 } qemuProcessStartFlags;
9c6c51
 
9c6c51
 int qemuProcessStart(virConnectPtr conn,
9c6c51
-- 
9c6c51
2.18.0
9c6c51