]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
snapshot: fix load/save state
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 19 Sep 2012 11:09:51 +0000 (13:09 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 19 Sep 2012 11:09:51 +0000 (13:09 +0200)
debian/patches/internal-snapshot.patch
debian/patches/load-state-from-blockdev.patch
debian/patches/move-bdrv-snapshot-find.patch

index 77f0338d3fd687e57fea3b2a61333ef7d81f4010..20e73c683d93cd1d1588e0c1d8d2082c396b7bba 100644 (file)
@@ -1,7 +1,7 @@
 Index: new/qapi-schema.json
 ===================================================================
---- new.orig/qapi-schema.json  2012-09-18 06:20:41.000000000 +0200
-+++ new/qapi-schema.json       2012-09-18 08:43:25.000000000 +0200
+--- new.orig/qapi-schema.json  2012-09-19 12:46:53.000000000 +0200
++++ new/qapi-schema.json       2012-09-19 12:51:10.000000000 +0200
 @@ -2493,3 +2493,12 @@
  # Since: 1.2.0
  ##
@@ -17,9 +17,9 @@ Index: new/qapi-schema.json
 +{ 'command': 'snapshot-end' }
 Index: new/qmp.c
 ===================================================================
---- new.orig/qmp.c     2012-09-18 06:20:41.000000000 +0200
-+++ new/qmp.c  2012-09-18 08:54:54.000000000 +0200
-@@ -479,3 +479,193 @@
+--- new.orig/qmp.c     2012-09-19 12:46:53.000000000 +0200
++++ new/qmp.c  2012-09-19 12:51:10.000000000 +0200
+@@ -479,3 +479,196 @@
      return arch_query_cpu_definitions(errp);
  }
  
@@ -33,6 +33,7 @@ Index: new/qmp.c
 +    BlockDriverState *bs = NULL;
 +    BlockDriver *drv = NULL;
 +    int bdrv_oflags = BDRV_O_NOCACHE | BDRV_O_RDWR;
++    int64_t pos;
 +    QEMUFile *f;
 +    int ret;
 +
@@ -69,7 +70,9 @@ Index: new/qmp.c
 +    ret = qemu_savevm_state(f);
 +
 +    // try to truncate, but ignore errors (will fail on block devices).
-+    bdrv_truncate(bs, qemu_ftell(f));
++    // note: bdrv_read() need whole blocks, so we round up
++    pos = qemu_ftell(f);
++    bdrv_truncate(bs, (pos + BDRV_SECTOR_SIZE) & BDRV_SECTOR_MASK);
 +
 +    qemu_fclose(f);
 +
@@ -215,8 +218,8 @@ Index: new/qmp.c
 +}
 Index: new/qmp-commands.hx
 ===================================================================
---- new.orig/qmp-commands.hx   2012-09-18 06:20:41.000000000 +0200
-+++ new/qmp-commands.hx        2012-09-18 08:43:25.000000000 +0200
+--- new.orig/qmp-commands.hx   2012-09-19 12:46:53.000000000 +0200
++++ new/qmp-commands.hx        2012-09-19 12:51:10.000000000 +0200
 @@ -2514,3 +2514,27 @@
          .args_type  = "",
          .mhandler.cmd_new = qmp_marshal_input_query_target,
@@ -247,8 +250,8 @@ Index: new/qmp-commands.hx
 +    },
 Index: new/hmp.c
 ===================================================================
---- new.orig/hmp.c     2012-09-18 06:20:41.000000000 +0200
-+++ new/hmp.c  2012-09-18 08:43:25.000000000 +0200
+--- new.orig/hmp.c     2012-09-19 12:46:53.000000000 +0200
++++ new/hmp.c  2012-09-19 12:51:10.000000000 +0200
 @@ -1102,3 +1102,40 @@
      qmp_closefd(fdname, &errp);
      hmp_handle_error(mon, &errp);
@@ -292,8 +295,8 @@ Index: new/hmp.c
 +}
 Index: new/hmp.h
 ===================================================================
---- new.orig/hmp.h     2012-09-18 06:20:41.000000000 +0200
-+++ new/hmp.h  2012-09-18 08:43:25.000000000 +0200
+--- new.orig/hmp.h     2012-09-19 12:46:53.000000000 +0200
++++ new/hmp.h  2012-09-19 12:51:10.000000000 +0200
 @@ -71,5 +71,9 @@
  void hmp_netdev_del(Monitor *mon, const QDict *qdict);
  void hmp_getfd(Monitor *mon, const QDict *qdict);
@@ -306,8 +309,8 @@ Index: new/hmp.h
  #endif
 Index: new/hmp-commands.hx
 ===================================================================
---- new.orig/hmp-commands.hx   2012-09-18 06:20:41.000000000 +0200
-+++ new/hmp-commands.hx        2012-09-18 08:43:25.000000000 +0200
+--- new.orig/hmp-commands.hx   2012-09-19 12:46:53.000000000 +0200
++++ new/hmp-commands.hx        2012-09-19 12:51:10.000000000 +0200
 @@ -1494,3 +1494,35 @@
  STEXI
  @end table
@@ -346,8 +349,8 @@ Index: new/hmp-commands.hx
 +    },
 Index: new/sysemu.h
 ===================================================================
---- new.orig/sysemu.h  2012-09-18 07:35:53.000000000 +0200
-+++ new/sysemu.h       2012-09-18 08:43:25.000000000 +0200
+--- new.orig/sysemu.h  2012-09-19 12:46:53.000000000 +0200
++++ new/sysemu.h       2012-09-19 12:51:10.000000000 +0200
 @@ -84,6 +84,7 @@
  int qemu_savevm_state_iterate(QEMUFile *f);
  int qemu_savevm_state_complete(QEMUFile *f);
@@ -358,9 +361,9 @@ Index: new/sysemu.h
  /* SLIRP */
 Index: new/savevm.c
 ===================================================================
---- new.orig/savevm.c  2012-09-18 08:53:28.000000000 +0200
-+++ new/savevm.c       2012-09-18 08:53:55.000000000 +0200
-@@ -1743,7 +1743,7 @@
+--- new.orig/savevm.c  2012-09-19 12:51:07.000000000 +0200
++++ new/savevm.c       2012-09-19 12:51:10.000000000 +0200
+@@ -1754,7 +1754,7 @@
      }
  }
  
index 1c00c6cd18b9f731fb1bbf352ff996082ec02bff..66a4c8f6983fe70bf8a0e8ddf2989df9881484bf 100644 (file)
@@ -1,8 +1,26 @@
 Index: new/savevm.c
 ===================================================================
---- new.orig/savevm.c  2012-09-18 07:20:45.000000000 +0200
-+++ new/savevm.c       2012-09-18 07:36:55.000000000 +0200
-@@ -2223,6 +2223,50 @@
+--- new.orig/savevm.c  2012-09-19 07:17:28.000000000 +0200
++++ new/savevm.c       2012-09-19 12:53:58.000000000 +0200
+@@ -407,6 +407,17 @@
+ static int block_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
+ {
++    int ret;
++    int64_t maxlen = bdrv_getlength(opaque);
++    if (pos > maxlen) {
++        return -EIO;
++    }
++    if ((pos + size) > maxlen) {
++        size = maxlen - pos - 1;
++    }
++    if (size == 0) {
++        return 0;
++    }
+     return bdrv_pread(opaque, pos, buf, size);
+ }
+@@ -2223,6 +2234,50 @@
      return;
  }
  
@@ -55,8 +73,8 @@ Index: new/savevm.c
      BlockDriverState *bs, *bs_vm_state;
 Index: new/sysemu.h
 ===================================================================
---- new.orig/sysemu.h  2012-09-18 07:35:26.000000000 +0200
-+++ new/sysemu.h       2012-09-18 07:35:53.000000000 +0200
+--- new.orig/sysemu.h  2012-09-19 07:17:21.000000000 +0200
++++ new/sysemu.h       2012-09-19 12:53:31.000000000 +0200
 @@ -72,6 +72,7 @@
  
  void do_savevm(Monitor *mon, const QDict *qdict);
@@ -67,8 +85,8 @@ Index: new/sysemu.h
  
 Index: new/qemu-options.hx
 ===================================================================
---- new.orig/qemu-options.hx   2012-09-18 07:39:54.000000000 +0200
-+++ new/qemu-options.hx        2012-09-18 07:52:56.000000000 +0200
+--- new.orig/qemu-options.hx   2012-09-19 07:17:28.000000000 +0200
++++ new/qemu-options.hx        2012-09-19 07:17:28.000000000 +0200
 @@ -2477,6 +2477,19 @@
  Start right away with a saved state (@code{loadvm} in monitor)
  ETEXI
@@ -91,8 +109,8 @@ Index: new/qemu-options.hx
      "-daemonize      daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
 Index: new/vl.c
 ===================================================================
---- new.orig/vl.c      2012-09-18 07:53:19.000000000 +0200
-+++ new/vl.c   2012-09-18 07:55:47.000000000 +0200
+--- new.orig/vl.c      2012-09-19 07:17:28.000000000 +0200
++++ new/vl.c   2012-09-19 07:17:28.000000000 +0200
 @@ -2364,6 +2364,7 @@
      int optind;
      const char *optarg;
index 3f411e8fbef5e5ab8386c168a2af73161ba1092b..371a60e3e3582c0762a9b34de741206fe2b082fd 100644 (file)
@@ -1,7 +1,7 @@
 Index: new/block.c
 ===================================================================
---- new.orig/block.c   2012-09-18 08:38:03.000000000 +0200
-+++ new/block.c        2012-09-18 08:39:00.000000000 +0200
+--- new.orig/block.c   2012-09-19 12:47:55.000000000 +0200
++++ new/block.c        2012-09-19 12:51:07.000000000 +0200
 @@ -2724,6 +2724,28 @@
      return -ENOTSUP;
  }
@@ -33,8 +33,8 @@ Index: new/block.c
  {
 Index: new/block.h
 ===================================================================
---- new.orig/block.h   2012-09-18 08:38:03.000000000 +0200
-+++ new/block.h        2012-09-18 08:39:42.000000000 +0200
+--- new.orig/block.h   2012-09-19 12:46:56.000000000 +0200
++++ new/block.h        2012-09-19 12:51:07.000000000 +0200
 @@ -302,6 +302,8 @@
  int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
  int bdrv_snapshot_list(BlockDriverState *bs,
@@ -46,9 +46,9 @@ Index: new/block.h
  char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn);
 Index: new/savevm.c
 ===================================================================
---- new.orig/savevm.c  2012-09-18 08:38:03.000000000 +0200
-+++ new/savevm.c       2012-09-18 08:39:05.000000000 +0200
-@@ -2034,28 +2034,6 @@
+--- new.orig/savevm.c  2012-09-19 12:50:39.000000000 +0200
++++ new/savevm.c       2012-09-19 12:51:07.000000000 +0200
+@@ -2045,28 +2045,6 @@
      return ret;
  }