]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
savevm-async: move global_state_store to the end
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 18 Sep 2015 11:56:26 +0000 (13:56 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Sun, 20 Sep 2015 08:07:21 +0000 (10:07 +0200)
The migration process does it in the end, and since we work
asynchronously it makes more sense for us, too. (This also
seems to fix some size and performance issues that regular
'savevm' is currently still experiencing.)

debian/patches/internal-snapshot-async.patch

index 3fd8950585e18b312c13193132f9ce7fb9a80812..a4823df53b4252cdf44ee25d6ce7562b116bc46a 100644 (file)
@@ -376,7 +376,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,515 @@
+@@ -0,0 +1,518 @@
 +#include "qemu-common.h"
 +#include "qapi/qmp/qerror.h"
 +#include "qemu/error-report.h"
@@ -542,6 +542,17 @@ Index: new/savevm-async.c
 +    return ret;
 +}
 +
++static int store_and_stop(void) {
++    if (global_state_store()) {
++        save_snapshot_error("Error saving global state");
++        return 1;
++    }
++    if (runstate_is_running()) {
++        vm_stop(RUN_STATE_SAVE_VM);
++    }
++    return 0;
++}
++
 +static void process_savevm_co(void *opaque)
 +{
 +    int ret;
@@ -577,9 +588,8 @@ Index: new/savevm-async.c
 +                DPRINTF("savevm inerate pending size %lu ret %d\n", pending_size, ret);
 +        } else {
 +            DPRINTF("done iterating\n");
-+            if (runstate_is_running()) {
-+                vm_stop(RUN_STATE_SAVE_VM);
-+            }
++            if (store_and_stop())
++                break;
 +            DPRINTF("savevm inerate finished\n");
 +            qemu_savevm_state_complete(snap_state.file);
 +            DPRINTF("save complete\n");
@@ -593,9 +603,8 @@ Index: new/savevm-async.c
 +        maxlen = bdrv_getlength(snap_state.bs) - 30*1024*1024;
 +        if ((pending_size < 100000) ||
 +            ((snap_state.bs_pos + pending_size) >= maxlen)) {
-+            if (runstate_is_running()) {
-+                vm_stop(RUN_STATE_SAVE_VM);
-+            }
++            if (store_and_stop())
++                break;
 +        }
 +    }
 +
@@ -847,12 +856,6 @@ Index: new/savevm-async.c
 +    QEMUFile *f;
 +    int ret;
 +
-+    ret = global_state_store();
-+    if (ret) {
-+        error_report("Error saving global state");
-+        goto the_end;
-+    }
-+
 +    bs = bdrv_new();
 +    ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_CACHE_WB, drv, &local_err);
 +    error_setg(&blocker, "block device is in use by load state");