]> git.proxmox.com Git - pve-qemu-kvm.git/blobdiff - debian/patches/internal-snapshot-async.patch
vmstate snapshot : implement cancelled state V2
[pve-qemu-kvm.git] / debian / patches / internal-snapshot-async.patch
index 4a6871d553832b01a36444e74bb329cf495360ca..52044f067ef7cc5c96f8e3a03c3f774eaf51b3e2 100644 (file)
@@ -23,9 +23,9 @@ Subject: [PATCH] internal-snapshot-async-qemu1.7.patch
 
 Index: new/Makefile.objs
 ===================================================================
---- new.orig/Makefile.objs     2014-08-07 11:56:07.000000000 +0200
-+++ new/Makefile.objs  2014-08-07 11:56:38.000000000 +0200
-@@ -57,6 +57,7 @@
+--- new.orig/Makefile.objs     2014-11-20 09:13:01.000000000 +0100
++++ new/Makefile.objs  2014-11-20 09:16:47.000000000 +0100
+@@ -56,6 +56,7 @@
  common-obj-y += qemu-char.o #aio.o
  common-obj-y += block-migration.o
  common-obj-y += page_cache.o xbzrle.o
@@ -35,22 +35,22 @@ Index: new/Makefile.objs
  
 Index: new/block.c
 ===================================================================
---- new.orig/block.c   2014-08-02 15:03:20.000000000 +0200
-+++ new/block.c        2014-08-07 13:26:45.000000000 +0200
-@@ -2083,7 +2083,7 @@
+--- new.orig/block.c   2014-11-20 09:13:01.000000000 +0100
++++ new/block.c        2014-11-20 09:16:47.000000000 +0100
+@@ -2119,7 +2119,7 @@
      bdrv_set_backing_hd(bs_top, bs_new);
  }
  
 -static void bdrv_delete(BlockDriverState *bs)
 +void bdrv_delete(BlockDriverState *bs)
  {
-     assert(!bs->dev);
      assert(!bs->job);
+     assert(bdrv_op_blocker_is_empty(bs));
 Index: new/hmp-commands.hx
 ===================================================================
---- new.orig/hmp-commands.hx   2014-08-07 11:56:20.000000000 +0200
-+++ new/hmp-commands.hx        2014-08-07 11:56:38.000000000 +0200
-@@ -1803,6 +1803,8 @@
+--- new.orig/hmp-commands.hx   2014-11-20 09:13:01.000000000 +0100
++++ new/hmp-commands.hx        2014-11-20 09:16:47.000000000 +0100
+@@ -1799,6 +1799,8 @@
  show current migration capabilities
  @item info migrate_cache_size
  show current migration XBZRLE cache size
@@ -59,7 +59,7 @@ Index: new/hmp-commands.hx
  @item info balloon
  show balloon information
  @item info qtree
-@@ -1824,3 +1826,35 @@
+@@ -1822,3 +1824,35 @@
  STEXI
  @end table
  ETEXI
@@ -97,11 +97,11 @@ Index: new/hmp-commands.hx
 +    },
 Index: new/hmp.c
 ===================================================================
---- new.orig/hmp.c     2014-08-07 11:56:20.000000000 +0200
-+++ new/hmp.c  2014-08-07 11:56:38.000000000 +0200
-@@ -1805,3 +1805,60 @@
+--- new.orig/hmp.c     2014-11-20 09:13:01.000000000 +0100
++++ new/hmp.c  2014-11-20 09:16:47.000000000 +0100
+@@ -1849,3 +1849,60 @@
  
-     monitor_printf(mon, "\n");
+     qapi_free_MemoryDeviceInfoList(info_list);
  }
 +
 +void hmp_savevm_start(Monitor *mon, const QDict *qdict)
@@ -162,8 +162,8 @@ Index: new/hmp.c
 +}
 Index: new/hmp.h
 ===================================================================
---- new.orig/hmp.h     2014-08-07 11:56:19.000000000 +0200
-+++ new/hmp.h  2014-08-07 11:56:38.000000000 +0200
+--- new.orig/hmp.h     2014-11-20 09:13:01.000000000 +0100
++++ new/hmp.h  2014-11-20 09:16:47.000000000 +0100
 @@ -26,6 +26,7 @@
  void hmp_info_uuid(Monitor *mon, const QDict *qdict);
  void hmp_info_chardev(Monitor *mon, const QDict *qdict);
@@ -185,20 +185,20 @@ Index: new/hmp.h
  void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
 Index: new/include/block/block.h
 ===================================================================
---- new.orig/include/block/block.h     2014-08-02 15:03:21.000000000 +0200
-+++ new/include/block/block.h  2014-08-07 11:56:38.000000000 +0200
-@@ -275,6 +275,7 @@
-     const char *backing_file);
+--- new.orig/include/block/block.h     2014-11-20 09:13:01.000000000 +0100
++++ new/include/block/block.h  2014-11-20 09:16:47.000000000 +0100
+@@ -235,6 +235,7 @@
  int bdrv_get_backing_file_depth(BlockDriverState *bs);
+ void bdrv_refresh_filename(BlockDriverState *bs);
  int bdrv_truncate(BlockDriverState *bs, int64_t offset);
 +void bdrv_delete(BlockDriverState *bs);
+ int64_t bdrv_nb_sectors(BlockDriverState *bs);
  int64_t bdrv_getlength(BlockDriverState *bs);
  int64_t bdrv_get_allocated_file_size(BlockDriverState *bs);
- void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
 Index: new/include/sysemu/sysemu.h
 ===================================================================
---- new.orig/include/sysemu/sysemu.h   2014-08-02 15:03:21.000000000 +0200
-+++ new/include/sysemu/sysemu.h        2014-08-07 11:56:38.000000000 +0200
+--- new.orig/include/sysemu/sysemu.h   2014-11-20 09:13:01.000000000 +0100
++++ new/include/sysemu/sysemu.h        2014-11-20 09:16:47.000000000 +0100
 @@ -76,16 +76,17 @@
  
  void do_savevm(Monitor *mon, const QDict *qdict);
@@ -221,8 +221,8 @@ Index: new/include/sysemu/sysemu.h
  int qemu_loadvm_state(QEMUFile *f);
 Index: new/monitor.c
 ===================================================================
---- new.orig/monitor.c 2014-08-07 11:56:19.000000000 +0200
-+++ new/monitor.c      2014-08-07 11:56:38.000000000 +0200
+--- new.orig/monitor.c 2014-11-20 09:13:01.000000000 +0100
++++ new/monitor.c      2014-11-20 09:16:47.000000000 +0100
 @@ -2876,6 +2876,13 @@
          .mhandler.cmd = hmp_info_migrate_cache_size,
      },
@@ -239,9 +239,9 @@ Index: new/monitor.c
          .params     = "",
 Index: new/qapi-schema.json
 ===================================================================
---- new.orig/qapi-schema.json  2014-08-07 11:56:20.000000000 +0200
-+++ new/qapi-schema.json       2014-08-07 11:56:38.000000000 +0200
-@@ -547,6 +547,42 @@
+--- new.orig/qapi-schema.json  2014-11-20 09:13:01.000000000 +0100
++++ new/qapi-schema.json       2014-11-20 09:16:47.000000000 +0100
+@@ -550,6 +550,42 @@
             '*downtime': 'int',
             '*setup-time': 'int'} }
  
@@ -284,7 +284,7 @@ Index: new/qapi-schema.json
  ##
  # @query-migrate
  #
-@@ -2644,8 +2680,18 @@
+@@ -2649,8 +2685,18 @@
  #
  # Since: 1.2.0
  ##
@@ -305,9 +305,9 @@ Index: new/qapi-schema.json
  #
 Index: new/qemu-options.hx
 ===================================================================
---- new.orig/qemu-options.hx   2014-08-07 11:55:39.000000000 +0200
-+++ new/qemu-options.hx        2014-08-07 11:56:38.000000000 +0200
-@@ -2951,6 +2951,19 @@
+--- new.orig/qemu-options.hx   2014-11-20 09:13:01.000000000 +0100
++++ new/qemu-options.hx        2014-11-20 09:16:47.000000000 +0100
+@@ -2975,6 +2975,19 @@
  Start right away with a saved state (@code{loadvm} in monitor)
  ETEXI
  
@@ -329,9 +329,9 @@ Index: new/qemu-options.hx
      "-daemonize      daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
 Index: new/qmp-commands.hx
 ===================================================================
---- new.orig/qmp-commands.hx   2014-08-07 11:56:19.000000000 +0200
-+++ new/qmp-commands.hx        2014-08-07 11:56:38.000000000 +0200
-@@ -3786,3 +3786,34 @@
+--- new.orig/qmp-commands.hx   2014-11-20 09:13:01.000000000 +0100
++++ new/qmp-commands.hx        2014-11-20 09:16:47.000000000 +0100
+@@ -3883,3 +3883,34 @@
  <- { "return": {} }
  
  EQMP
@@ -369,8 +369,8 @@ Index: new/qmp-commands.hx
 Index: new/savevm-async.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ new/savevm-async.c 2014-08-07 13:29:41.000000000 +0200
-@@ -0,0 +1,488 @@
++++ new/savevm-async.c 2014-11-20 09:17:48.000000000 +0100
+@@ -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 = {
@@ -632,12 +640,8 @@ Index: new/savevm-async.c
 +    }
 +
 +    /* Open the image */
-+    snap_state.bs = bdrv_new("vmstate", &local_err);
-+    if (local_err) {
-+        error_propagate(errp, local_err);
-+        goto restart;
-+    }
-+
++    snap_state.bs = bdrv_new();
++ 
 +    ret = bdrv_open(&snap_state.bs, statefile, NULL, NULL, bdrv_oflags, drv, &local_err);
 +    if (ret < 0) {
 +        error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
@@ -677,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();
 +    }
@@ -822,7 +831,7 @@ Index: new/savevm-async.c
 +    QEMUFile *f;
 +    int ret = -1;
 +
-+    bs = bdrv_new("vmstate", &error_abort);
++    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");
 +    bdrv_op_block_all(bs, blocker);
@@ -861,8 +870,8 @@ Index: new/savevm-async.c
 +}
 Index: new/savevm.c
 ===================================================================
---- new.orig/savevm.c  2014-08-02 15:03:21.000000000 +0200
-+++ new/savevm.c       2014-08-07 11:56:38.000000000 +0200
+--- new.orig/savevm.c  2014-11-20 09:13:01.000000000 +0100
++++ new/savevm.c       2014-11-20 09:16:47.000000000 +0100
 @@ -596,11 +596,11 @@
      return false;
  }
@@ -913,9 +922,9 @@ Index: new/savevm.c
  uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)
 Index: new/vl.c
 ===================================================================
---- new.orig/vl.c      2014-08-07 11:55:57.000000000 +0200
-+++ new/vl.c   2014-08-07 11:56:38.000000000 +0200
-@@ -2930,6 +2930,7 @@
+--- new.orig/vl.c      2014-11-20 09:13:01.000000000 +0100
++++ new/vl.c   2014-11-20 09:16:47.000000000 +0100
+@@ -2760,6 +2760,7 @@
      int optind;
      const char *optarg;
      const char *loadvm = NULL;
@@ -923,7 +932,7 @@ Index: new/vl.c
      MachineClass *machine_class;
      const char *cpu_model;
      const char *vga_model = NULL;
-@@ -3625,6 +3626,9 @@
+@@ -3457,6 +3458,9 @@
            case QEMU_OPTION_loadvm:
                loadvm = optarg;
                break;
@@ -933,7 +942,7 @@ Index: new/vl.c
              case QEMU_OPTION_full_screen:
                  full_screen = 1;
                  break;
-@@ -4569,6 +4573,10 @@
+@@ -4428,6 +4432,10 @@
          if (load_vmstate(loadvm) < 0) {
              autostart = 0;
          }
@@ -943,4 +952,4 @@ Index: new/vl.c
 +        }
      }
  
-     qdev_prop_check_global();
+     qdev_prop_check_globals();