render / rpms / libvirt

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