[libvirt] [PATCH 0/2] Avoid infinite loop if vCPUs can't be resumed in qemu snapshot code

Messed up refactor :(. Bunny ears of shame were applied. Peter Krempa (2): qemu: snapshot: Don't overwrite existing errors when thawing filesystems qemu: snapshot: Avoid infinite loop if vCPUs can't be resumed src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.6.2

If we are attempting to thaw the filesystems on error, the code would overwrite the error code that caused the snapshot to fail with the error of thawing the filesystem. Since the thawing function allows control of error reporting behavior we can use this feature. --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f2db7d7..a10671f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14696,7 +14696,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, } if (thaw != 0 && - qemuDomainSnapshotFSThaw(driver, vm, thaw > 0) < 0) { + qemuDomainSnapshotFSThaw(driver, vm, ret == 0 && thaw > 0) < 0) { /* helper reported the error, if it was needed */ if (thaw > 0) ret = -1; -- 2.6.2

In b3d2a42e I've refactored the code and moved the 'cleanup' label. Unfortunately the code that was originally in the 'endjob' label and wanted to jump to cleanup is now in the cleanup label. Remove the jump and let the function finish. --- src/qemu/qemu_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a10671f..6fc11c6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14692,7 +14692,6 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, } ret = -1; - goto cleanup; } if (thaw != 0 && -- 2.6.2

On Fri, Feb 05, 2016 at 05:07:27PM +0100, Peter Krempa wrote:
Messed up refactor :(. Bunny ears of shame were applied.
Peter Krempa (2): qemu: snapshot: Don't overwrite existing errors when thawing filesystems qemu: snapshot: Avoid infinite loop if vCPUs can't be resumed
src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
ACK series, nice optimization. Jan

On Sat, Feb 06, 2016 at 11:37:45 +0100, Ján Tomko wrote:
On Fri, Feb 05, 2016 at 05:07:27PM +0100, Peter Krempa wrote:
Messed up refactor :(. Bunny ears of shame were applied.
Peter Krempa (2): qemu: snapshot: Don't overwrite existing errors when thawing filesystems qemu: snapshot: Avoid infinite loop if vCPUs can't be resumed
src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
ACK series, nice optimization.
Pushed; Thanks. Peter
participants (2)
-
Ján Tomko
-
Peter Krempa