[libvirt] [PATCH v5 14/36] qemu_process: Stop retaining Monitor config in qemuProcessQmp

Chris Venteicher posted 36 patches 7 years, 2 months ago
There is a newer version of this series
[libvirt] [PATCH v5 14/36] qemu_process: Stop retaining Monitor config in qemuProcessQmp
Posted by Chris Venteicher 7 years, 2 months ago
The monitor config data is removed from the qemuProcessQmp struct.

The monitor config data can be initialized immediately before call to
qemuMonitorOpen and does not need to be maintained after the call
because qemuMonitorOpen copies any strings it needs.

Signed-off-by: Chris Venteicher <cventeic@redhat.com>
---
 src/qemu/qemu_process.c | 9 +++++----
 src/qemu/qemu_process.h | 1 -
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index fc15cb1a3c..8906a22e3c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8263,13 +8263,14 @@ qemuProcessQmpConnectMonitor(qemuProcessQmpPtr proc)
 {
     int ret = -1;
     virDomainXMLOptionPtr xmlopt = NULL;
+    virDomainChrSourceDef monConfig;
 
     VIR_DEBUG("proc=%p, emulator=%s, proc->pid=%lld",
               proc, NULLSTR(proc->binary), (long long)proc->pid);
 
-    proc->config.type = VIR_DOMAIN_CHR_TYPE_UNIX;
-    proc->config.data.nix.path = proc->monpath;
-    proc->config.data.nix.listen = false;
+    monConfig.type = VIR_DOMAIN_CHR_TYPE_UNIX;
+    monConfig.data.nix.path = proc->monpath;
+    monConfig.data.nix.listen = false;
 
     if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) ||
         !(proc->vm = virDomainObjNew(xmlopt)))
@@ -8277,7 +8278,7 @@ qemuProcessQmpConnectMonitor(qemuProcessQmpPtr proc)
 
     proc->vm->pid = proc->pid;
 
-    if (!(proc->mon = qemuMonitorOpen(proc->vm, &proc->config, true, true,
+    if (!(proc->mon = qemuMonitorOpen(proc->vm, &monConfig, true, true,
                                       0, &callbacks, NULL)))
         goto cleanup;
 
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 9967766120..0a79d15290 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -228,7 +228,6 @@ struct _qemuProcessQmp {
     char *pidfile;
     virCommandPtr cmd;
     qemuMonitorPtr mon;
-    virDomainChrSourceDef config;
     pid_t pid;
     virDomainObjPtr vm;
     bool forceTCG;
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v5 14/36] qemu_process: Stop retaining Monitor config in qemuProcessQmp
Posted by Jiri Denemark 7 years, 1 month ago
On Sun, Dec 02, 2018 at 23:10:08 -0600, Chris Venteicher wrote:
> The monitor config data is removed from the qemuProcessQmp struct.
> 
> The monitor config data can be initialized immediately before call to
> qemuMonitorOpen and does not need to be maintained after the call
> because qemuMonitorOpen copies any strings it needs.

Yeah, I was thinking we should do this when I saw "qemu_process: Collect
monitor code in single function" patch.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list