mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemu: Restore errors when rolling back disk image state
Some operations done to rollback disk image labelling and locking might overwrite (or clear) the actual error. Remember the original error when tearing down disk access so that it's not obscured. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1461301
This commit is contained in:
parent
6f18150f7b
commit
a823d0a62e
@ -94,6 +94,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
int ret = -1;
|
||||
virStorageSourcePtr origsrc = NULL;
|
||||
virErrorPtr orig_err = NULL;
|
||||
|
||||
if (overridesrc) {
|
||||
origsrc = disk->src;
|
||||
@ -102,6 +103,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
|
||||
|
||||
/* just tear down the disk access */
|
||||
if (teardown) {
|
||||
virErrorPreserveLast(&orig_err);
|
||||
ret = 0;
|
||||
goto rollback_cgroup;
|
||||
}
|
||||
@ -145,6 +147,8 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
|
||||
if (origsrc)
|
||||
disk->src = origsrc;
|
||||
|
||||
virErrorRestore(&orig_err);
|
||||
|
||||
virObjectUnref(cfg);
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user