Re: [PATCH] qemu_monitor: search memballoon QOM device path using alias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 25, 2016 at 05:26:48PM +0200, Pavel Hrdina wrote:
Commit 4a585a88 introduced searching QOM device path by alias, let's use it for
memballoon too.  This may speedup the search because in most cases we will find
the correct QOM device path directly by using alias without the need for the
recursion code.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
src/qemu/qemu_driver.c  |  5 +++--
src/qemu/qemu_monitor.c | 29 ++++++++++++++++++-----------
src/qemu/qemu_monitor.h |  2 ++
src/qemu/qemu_process.c | 10 ++++------
4 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1fac4de..58c04d5 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1084,16 +1085,20 @@ qemuMonitorInitBalloonObjectPath(qemuMonitorPtr mon)
    }
    mon->ballooninit = true;

-    flp_ret = qemuMonitorJSONFindLinkPath(mon, "virtio-balloon-pci", NULL, &path);
-    if (flp_ret == -2) {
-        /* pci object was not found retry search for ccw object */
-        if (qemuMonitorJSONFindLinkPath(mon, "virtio-balloon-ccw",
-                                        NULL, &path) < 0)
-            return;
-    } else if (flp_ret < 0) {
+    switch (balloon->info.type) {
+    case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
+        name = "virtio-balloon-pci";
+        break;
+    case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
+        name = "virtio-balloon-ccw";
+        break;
+    default:

Wow, we even fixed something here :)

anyway, the function could just rip out everything from the vm pointer
as there probably won't be any call that's not using the same parameter
syntax, I guess.  But that's yet for another day.  ACK.

Attachment: signature.asc
Description: Digital signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]