mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
qemu: process: Fix failure semantics for perf events
For strange reasons if a perf event type was not supported or failed to be enabled at VM start libvirt would ignore the failure. On the other hand on restart if the event could not be re-enabled libvirt would fail to reconnect to the VM and kill it. Both don't make really sense. Fix it by failing to start the VM if the event is not supported and change the event to disabled if it can't be reconnected (unlikely). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329045
This commit is contained in:
parent
e64e394223
commit
edadd46c05
@ -3501,17 +3501,14 @@ qemuDomainPerfRestart(virDomainObjPtr vm)
|
||||
for (i = 0; i < VIR_PERF_EVENT_LAST; i++) {
|
||||
if (def->perf->events[i] &&
|
||||
def->perf->events[i] == VIR_TRISTATE_BOOL_YES) {
|
||||
if (virPerfEventEnable(priv->perf, i, vm->pid))
|
||||
goto cleanup;
|
||||
|
||||
/* Failure to re-enable the perf event should not be fatal */
|
||||
if (virPerfEventEnable(priv->perf, i, vm->pid) < 0)
|
||||
def->perf->events[i] = VIR_TRISTATE_BOOL_NO;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
virPerfFree(priv->perf);
|
||||
priv->perf = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct qemuProcessReconnectData {
|
||||
@ -5414,8 +5411,9 @@ qemuProcessLaunch(virConnectPtr conn,
|
||||
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);
|
||||
if (vm->def->perf->events[i] == VIR_TRISTATE_BOOL_YES &&
|
||||
virPerfEventEnable(priv->perf, i, vm->pid) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* This must be done after cgroup placement to avoid resetting CPU
|
||||
|
Loading…
x
Reference in New Issue
Block a user