提交 02ed255e 编写于 作者: J Jim Fehlig

libxl: Fix removing non-persistent domain after save

libxlDoDomainSave() was removing non-persistent domains, but
required callers to have the virDomainObj locked.  Callers could
potentially unlock an already freed virDomainObj.  Move this
logic to the callers of libxlDoDomainSave().
上级 ce33422d
...@@ -2128,12 +2128,6 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, ...@@ -2128,12 +2128,6 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
} }
vm->hasManagedSave = true; vm->hasManagedSave = true;
if (!vm->persistent) {
virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
ret = 0; ret = 0;
cleanup: cleanup:
...@@ -2176,7 +2170,15 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml, ...@@ -2176,7 +2170,15 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
goto cleanup; goto cleanup;
} }
ret = libxlDoDomainSave(driver, vm, to); if (libxlDoDomainSave(driver, vm, to) < 0)
goto cleanup;
if (!vm->persistent) {
virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
ret = 0;
cleanup: cleanup:
if (vm) if (vm)
...@@ -2375,7 +2377,15 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags) ...@@ -2375,7 +2377,15 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
VIR_INFO("Saving state to %s", name); VIR_INFO("Saving state to %s", name);
ret = libxlDoDomainSave(driver, vm, name); if (libxlDoDomainSave(driver, vm, name) < 0)
goto cleanup;
if (!vm->persistent) {
virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
ret = 0;
cleanup: cleanup:
if (vm) if (vm)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册