提交 0daec353 编写于 作者: J John Ferlan

lxc: Use consistent error preservation and restoration calls

Provide some consistency over error message variable name and usage
when saving error messages across possible other errors or possibility
of resetting of the last error.

Instead of virSaveLastError paired up with virSetError and virFreeError,
we should use the newer virErrorPreserveLast and virRestoreError.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 57a9d2fe
......@@ -1857,12 +1857,11 @@ static int lxcSetVcpuBWLive(virCgroupPtr cgroup, unsigned long long period,
error:
if (period) {
virErrorPtr saved = virSaveLastError();
virErrorPtr saved;
virErrorPreserveLast(&saved);
virCgroupSetCpuCfsPeriod(cgroup, old_period);
if (saved) {
virSetError(saved);
virFreeError(saved);
}
virErrorRestore(&saved);
}
return -1;
......
......@@ -1568,7 +1568,7 @@ int virLXCProcessStart(virConnectPtr conn,
rc = -1;
}
if (rc != 0) {
err = virSaveLastError();
virErrorPreserveLast(&err);
virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
}
virCommandFree(cmd);
......@@ -1582,10 +1582,7 @@ int virLXCProcessStart(virConnectPtr conn,
virObjectUnref(cfg);
virObjectUnref(caps);
if (err) {
virSetError(err);
virFreeError(err);
}
virErrorRestore(&err);
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册