render / rpms / libvirt

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