[PATCH 06/10] Only call qemuMonitorGetMemoryStats for virtio memballoon

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

 



There is nothing to get from the monitor for model='none'.
---
 src/qemu/qemu_driver.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 50eebf9..4690406 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11599,14 +11599,19 @@ qemuDomainMemoryStats(virDomainPtr dom,
         goto endjob;
     }
 
-    priv = vm->privateData;
-    qemuDomainObjEnterMonitor(driver, vm);
-    ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats);
-    if (qemuDomainObjExitMonitor(driver, vm) < 0)
-        ret = -1;
+    if (vm->def->memballoon &&
+        vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+        priv = vm->privateData;
+        qemuDomainObjEnterMonitor(driver, vm);
+        ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats);
+        if (qemuDomainObjExitMonitor(driver, vm) < 0)
+            ret = -1;
 
-    if (ret < 0 || ret >= nr_stats)
-        goto endjob;
+        if (ret < 0 || ret >= nr_stats)
+            goto endjob;
+    } else {
+        ret = 0;
+    }
 
     if (qemuGetProcessInfo(NULL, NULL, &rss, vm->pid, 0) < 0) {
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-- 
2.3.6

--
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]