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>
---
src/libxl/libxl_driver.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 34adef8d48..df53dead0a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -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)
--
2.16.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, May 14, 2018 at 04:44:15PM -0600, Jim Fehlig wrote: > 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> > --- > src/libxl/libxl_driver.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.