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

Martin Kletzander mkletzan at redhat.com
Mon Jul 25 15:46:44 UTC 2016


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 at redhat.com>
>---
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160725/96d71433/attachment-0001.sig>


More information about the libvir-list mailing list