提交 bf9bc046 编写于 作者: Q Qiaowei Ren 提交者: Daniel P. Berrange

perf: reenable perf events when libvirtd restart

When libvirtd daemon restart, this patch will reenable those perf
events previously enabled.
Signed-off-by: NQiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-7-git-send-email-qiaowei.ren@intel.com
上级 afe833e9
......@@ -3419,6 +3419,34 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver,
return ret;
}
static int
qemuDomainPerfRestart(virDomainObjPtr vm)
{
size_t i;
virDomainDefPtr def = vm->def;
qemuDomainObjPrivatePtr priv = vm->privateData;
virPerfFree(priv->perf);
priv->perf = virPerfNew();
if (!priv->perf)
return -1;
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;
}
}
return 0;
cleanup:
virPerfFree(priv->perf);
return -1;
}
struct qemuProcessReconnectData {
virConnectPtr conn;
virQEMUDriverPtr driver;
......@@ -3495,6 +3523,9 @@ qemuProcessReconnect(void *opaque)
if (qemuConnectCgroup(driver, obj) < 0)
goto error;
if (qemuDomainPerfRestart(obj) < 0)
goto error;
/* XXX: Need to change as long as lock is introduced for
* qemu_driver->sharedDevices.
*/
......@@ -6090,6 +6121,9 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
if (virSecurityManagerGenLabel(driver->securityManager, vm->def) < 0)
goto error;
if (qemuDomainPerfRestart(vm) < 0)
goto error;
VIR_DEBUG("Creating domain log file");
if (!(logCtxt = qemuDomainLogContextNew(driver, vm,
QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册