]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
vmstate snapshot : implement cancelled state V2
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 21 Nov 2014 09:26:02 +0000 (10:26 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 21 Nov 2014 11:14:33 +0000 (12:14 +0100)
currently, if we cancel a active savevm job with savevm-end,
we don't close the vmstate file.

This implement a new state CANCELLED, which is setup if savevm-end is called
when savevm is ACTIVE

then, in the coroutine, if state CANCELLED is detected,
we call save_snapshot_completed() to properly close the file
then qmp_savevm_end to finish the job

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
debian/patches/internal-snapshot-async.patch

index 395c54cc05aca4590cff0b10ad7c7e47e9fee2bc..52044f067ef7cc5c96f8e3a03c3f774eaf51b3e2 100644 (file)
@@ -370,7 +370,7 @@ Index: new/savevm-async.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
 +++ new/savevm-async.c 2014-11-20 09:17:48.000000000 +0100
-@@ -0,0 +1,484 @@
+@@ -0,0 +1,497 @@
 +#include "qemu-common.h"
 +#include "qapi/qmp/qerror.h"
 +#include "sysemu/sysemu.h"
@@ -399,6 +399,7 @@ Index: new/savevm-async.c
 +    SAVE_STATE_ERROR,
 +    SAVE_STATE_ACTIVE,
 +    SAVE_STATE_COMPLETED,
++    SAVE_STATE_CANCELLED
 +};
 +
 +
@@ -588,6 +589,13 @@ Index: new/savevm-async.c
 +            }
 +        }
 +    }
++
++    if(snap_state.state == SAVE_STATE_CANCELLED) {
++        save_snapshot_completed();
++        Error *errp = NULL;
++        qmp_savevm_end(&errp);
++    }
++
 +}
 +
 +static const QEMUFileOps block_file_ops = {
@@ -673,6 +681,11 @@ Index: new/savevm-async.c
 +        return;
 +    }
 +
++    if (snap_state.state == SAVE_STATE_ACTIVE) {
++        snap_state.state = SAVE_STATE_CANCELLED;
++        return;
++    }
++
 +    if (snap_state.saved_vm_running) {
 +        vm_start();
 +    }