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