[PATCH 1/6] qemu: perf: Don't ignore perf setup if allocation fails

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

 



Reject the VM startup if the perf event structure can't be allocated.
---
 src/qemu/qemu_process.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0ccc3ac..f8d13aa 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5410,12 +5410,12 @@ qemuProcessLaunch(virConnectPtr conn,
     if (qemuSetupCgroup(driver, vm, nnicindexes, nicindexes) < 0)
         goto cleanup;

-    priv->perf = virPerfNew();
-    if (priv->perf) {
-        for (i = 0; i < VIR_PERF_EVENT_LAST; i++) {
-            if (vm->def->perf->events[i] == VIR_TRISTATE_BOOL_YES)
-                virPerfEventEnable(priv->perf, i, vm->pid);
-        }
+    if (!(priv->perf = virPerfNew()))
+        goto cleanup;
+
+    for (i = 0; i < VIR_PERF_EVENT_LAST; i++) {
+        if (vm->def->perf->events[i] == VIR_TRISTATE_BOOL_YES)
+            virPerfEventEnable(priv->perf, i, vm->pid);
     }

     /* This must be done after cgroup placement to avoid resetting CPU
-- 
2.8.1

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