[pve-devel] [PATCH pve-qemu-kvm] savevm-async: move global_state_store to the end

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Sep 18 13:56:26 CEST 2015


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 | 29 +++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/debian/patches/internal-snapshot-async.patch b/debian/patches/internal-snapshot-async.patch
index 3fd8950..a4823df 100644
--- a/debian/patches/internal-snapshot-async.patch
+++ b/debian/patches/internal-snapshot-async.patch
@@ -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");
-- 
2.1.4





More information about the pve-devel mailing list