mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user