]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: perf: Don't ignore perf setup if allocation fails
authorPeter Krempa <pkrempa@redhat.com>
Wed, 27 Apr 2016 12:40:23 +0000 (14:40 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 2 May 2016 07:06:52 +0000 (09:06 +0200)
Reject the VM startup if the perf event structure can't be allocated.

src/qemu/qemu_process.c

index 4a7c141b933fa2533fc2eeb5ee95390146a4cee6..4dd0fc37f956be641ea7f4f918894d561f7c4878 100644 (file)
@@ -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