[PATCH 05/10] Invert the condition in qemuDomainMemoryStats

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

 



It only makes sense if qemuMonitorGetMemoryStats is called,
but the following patch will make that call conditional.
---
 src/qemu/qemu_driver.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 818862b..50eebf9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11580,6 +11580,7 @@ qemuDomainMemoryStats(virDomainPtr dom,
     qemuDomainObjPrivatePtr priv;
     virDomainObjPtr vm;
     int ret = -1;
+    long rss;
 
     virCheckFlags(0, -1);
 
@@ -11604,17 +11605,16 @@ qemuDomainMemoryStats(virDomainPtr dom,
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         ret = -1;
 
-    if (ret >= 0 && ret < nr_stats) {
-        long rss;
-        if (qemuGetProcessInfo(NULL, NULL, &rss, vm->pid, 0) < 0) {
-            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                           _("cannot get RSS for domain"));
-        } else {
-            stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS;
-            stats[ret].val = rss;
-            ret++;
-        }
+    if (ret < 0 || ret >= nr_stats)
+        goto endjob;
 
+    if (qemuGetProcessInfo(NULL, NULL, &rss, vm->pid, 0) < 0) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                       _("cannot get RSS for domain"));
+    } else {
+        stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS;
+        stats[ret].val = rss;
+        ret++;
     }
 
  endjob:
-- 
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]