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().
This commit is contained in:
Jim Fehlig 2013-01-21 10:32:34 -07:00
parent ce33422d35
commit 02ed255e22
1 changed files with 18 additions and 8 deletions

View File

@ -2128,12 +2128,6 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
}
vm->hasManagedSave = true;
if (!vm->persistent) {
virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
ret = 0;
cleanup:
@ -2176,7 +2170,15 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
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:
if (vm)
@ -2375,7 +2377,15 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
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:
if (vm)