mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
libxl: don't set hasManagedSave when performing save
libxlDoDomainSave() is used in both the save and managedsave code paths but was unconditionally setting hasManagedSave to true on success. As a result, undefine would fail after a non-managed save/restore operation. E.g. virsh define; virsh start virsh save; virsh restore virsh shutdown virsh undefine error: Refusing to undefine while domain managed save image exists Modify libxlDoDomainSave() to take an additional parameter to specify managed vs non-managed save, and change callers to use it. Signed-off-by: Jim Fehlig <jfehlig@suse.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
f50ad2ff63
commit
ac4a12db71
@ -1653,8 +1653,10 @@ libxlDomainGetState(virDomainPtr dom,
|
||||
* virDomainObjPtr must be locked on invocation
|
||||
*/
|
||||
static int
|
||||
libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
||||
const char *to)
|
||||
libxlDoDomainSave(libxlDriverPrivatePtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *to,
|
||||
bool managed)
|
||||
{
|
||||
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
|
||||
libxlSavefileHeader hdr;
|
||||
@ -1725,7 +1727,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
libxlDomainCleanup(driver, vm);
|
||||
vm->hasManagedSave = true;
|
||||
vm->hasManagedSave = managed;
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
@ -1772,7 +1774,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
|
||||
if (virDomainObjCheckActive(vm) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (libxlDoDomainSave(driver, vm, to) < 0)
|
||||
if (libxlDoDomainSave(driver, vm, to, false) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!vm->persistent)
|
||||
@ -1989,7 +1991,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
|
||||
|
||||
VIR_INFO("Saving state to %s", name);
|
||||
|
||||
if (libxlDoDomainSave(driver, vm, name) < 0)
|
||||
if (libxlDoDomainSave(driver, vm, name, true) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!vm->persistent)
|
||||
|
Loading…
Reference in New Issue
Block a user