]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
backup: start jobs in paused state
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 2 Dec 2013 13:11:07 +0000 (14:11 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 2 Dec 2013 13:11:07 +0000 (14:11 +0100)
That way we can backup one drive after another (reduce load).

debian/patches/backup-add-pve-monitor-commands.patch
debian/patches/backup-modify-job-api.patch

index ba15ff89c84b47c027b7f5de099fc6872cf530ef..2dd68576599cd8a36d55325e66aa67516348d9be 100644 (file)
@@ -1,7 +1,7 @@
 Index: new/blockdev.c
 ===================================================================
---- new.orig/blockdev.c        2013-12-02 11:40:36.000000000 +0100
-+++ new/blockdev.c     2013-12-02 12:07:54.000000000 +0100
+--- new.orig/blockdev.c        2013-12-02 12:54:24.000000000 +0100
++++ new/blockdev.c     2013-12-02 14:10:24.000000000 +0100
 @@ -45,6 +45,7 @@
  #include "qmp-commands.h"
  #include "trace.h"
@@ -10,7 +10,7 @@ Index: new/blockdev.c
  
  static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
  
-@@ -1438,6 +1439,417 @@
+@@ -1438,6 +1439,418 @@
      }
  }
  
@@ -161,14 +161,14 @@ Index: new/blockdev.c
 +    while (l) {
 +        PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
 +        l = g_list_next(l);
-+
-+        if (di->bs && di->bs->job && !di->completed) {
-+            if (block_job_is_paused(di->bs->job)) {
++        BlockJob *job = di->bs->job;
++        if (di->bs && job && !di->completed) {
++            if (block_job_is_paused(job)) {
 +                bool cancel = backup_state.error || backup_state.cancel;
 +                if (cancel) {
-+                    block_job_cancel(di->bs->job);
++                    block_job_cancel(job);
 +                } else {
-+                    block_job_resume(di->bs->job);
++                    block_job_resume(job);
 +                }
 +            }
 +            return;
@@ -342,7 +342,8 @@ Index: new/blockdev.c
 +
 +        backup_start(di->bs, NULL, speed, MIRROR_SYNC_MODE_FULL,
 +                     BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
-+                     pvebackup_dump_cb, pvebackup_complete_cb, di, &local_err);
++                     pvebackup_dump_cb, pvebackup_complete_cb, di,
++                     true, &local_err);
 +        if (local_err != NULL) {
 +            error_setg(&backup_state.error, "backup_job_create failed");
 +            pvebackup_cancel(NULL);
@@ -430,8 +431,8 @@ Index: new/blockdev.c
  {
 Index: new/hmp-commands.hx
 ===================================================================
---- new.orig/hmp-commands.hx   2013-11-27 10:51:33.000000000 +0100
-+++ new/hmp-commands.hx        2013-12-02 11:40:36.000000000 +0100
+--- new.orig/hmp-commands.hx   2013-12-02 12:49:36.000000000 +0100
++++ new/hmp-commands.hx        2013-12-02 12:58:31.000000000 +0100
 @@ -83,6 +83,35 @@
  Copy data from a backing file into a block device.
  ETEXI
@@ -479,8 +480,8 @@ Index: new/hmp-commands.hx
  @item info migrate_capabilities
 Index: new/hmp.c
 ===================================================================
---- new.orig/hmp.c     2013-12-02 11:40:35.000000000 +0100
-+++ new/hmp.c  2013-12-02 11:40:36.000000000 +0100
+--- new.orig/hmp.c     2013-12-02 12:49:36.000000000 +0100
++++ new/hmp.c  2013-12-02 12:58:31.000000000 +0100
 @@ -133,6 +133,38 @@
      qapi_free_MouseInfoList(mice_list);
  }
@@ -560,8 +561,8 @@ Index: new/hmp.c
      Error *error = NULL;
 Index: new/hmp.h
 ===================================================================
---- new.orig/hmp.h     2013-11-27 10:51:33.000000000 +0100
-+++ new/hmp.h  2013-12-02 11:40:36.000000000 +0100
+--- new.orig/hmp.h     2013-12-02 12:49:36.000000000 +0100
++++ new/hmp.h  2013-12-02 12:58:31.000000000 +0100
 @@ -28,6 +28,7 @@
  void hmp_info_migrate(Monitor *mon, const QDict *qdict);
  void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
@@ -581,8 +582,8 @@ Index: new/hmp.h
  void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
 Index: new/monitor.c
 ===================================================================
---- new.orig/monitor.c 2013-11-27 10:51:33.000000000 +0100
-+++ new/monitor.c      2013-12-02 11:40:36.000000000 +0100
+--- new.orig/monitor.c 2013-12-02 12:49:36.000000000 +0100
++++ new/monitor.c      2013-12-02 12:58:31.000000000 +0100
 @@ -2880,6 +2880,13 @@
      },
  #endif
@@ -599,8 +600,8 @@ Index: new/monitor.c
          .params     = "",
 Index: new/qapi-schema.json
 ===================================================================
---- new.orig/qapi-schema.json  2013-12-02 11:40:35.000000000 +0100
-+++ new/qapi-schema.json       2013-12-02 11:40:36.000000000 +0100
+--- new.orig/qapi-schema.json  2013-12-02 12:49:36.000000000 +0100
++++ new/qapi-schema.json       2013-12-02 12:58:31.000000000 +0100
 @@ -547,6 +547,95 @@
  ##
  { 'command': 'query-events', 'returns': ['EventInfo'] }
@@ -699,8 +700,8 @@ Index: new/qapi-schema.json
  #
 Index: new/qmp-commands.hx
 ===================================================================
---- new.orig/qmp-commands.hx   2013-12-02 11:40:35.000000000 +0100
-+++ new/qmp-commands.hx        2013-12-02 11:40:36.000000000 +0100
+--- new.orig/qmp-commands.hx   2013-12-02 12:49:36.000000000 +0100
++++ new/qmp-commands.hx        2013-12-02 12:58:31.000000000 +0100
 @@ -966,6 +966,24 @@
  EQMP
  
index c4dab45e187c0b3c4503033ea4fca551510a87cf..bc6c75a84757d62abff48682f24f5b4ac0929526 100644 (file)
@@ -1,7 +1,7 @@
 Index: new/block/backup.c
 ===================================================================
---- new.orig/block/backup.c    2013-11-27 10:51:32.000000000 +0100
-+++ new/block/backup.c 2013-12-02 07:41:30.000000000 +0100
+--- new.orig/block/backup.c    2013-12-02 12:30:23.000000000 +0100
++++ new/block/backup.c 2013-12-02 12:56:03.000000000 +0100
 @@ -39,6 +39,7 @@
      BlockDriverState *target;
      MirrorSyncMode sync_mode;
@@ -88,12 +88,13 @@ Index: new/block/backup.c
  
      block_job_completed(&job->common, ret);
  }
-@@ -347,13 +364,14 @@
+@@ -347,13 +364,15 @@
                    int64_t speed, MirrorSyncMode sync_mode,
                    BlockdevOnError on_source_error,
                    BlockdevOnError on_target_error,
 +                  BackupDumpFunc *dump_cb,
                    BlockDriverCompletionFunc *cb, void *opaque,
++                  bool paused,
                    Error **errp)
  {
      int64_t len;
@@ -104,7 +105,7 @@ Index: new/block/backup.c
      assert(cb);
  
      if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
-@@ -376,6 +394,7 @@
+@@ -376,10 +395,12 @@
          return;
      }
  
@@ -112,23 +113,28 @@ Index: new/block/backup.c
      job->on_source_error = on_source_error;
      job->on_target_error = on_target_error;
      job->target = target;
+     job->sync_mode = sync_mode;
++    job->common.paused = paused;
+     job->common.len = len;
+     job->common.co = qemu_coroutine_create(backup_run);
+     qemu_coroutine_enter(job->common.co, job);
 Index: new/blockdev.c
 ===================================================================
---- new.orig/blockdev.c        2013-12-02 06:12:24.000000000 +0100
-+++ new/blockdev.c     2013-12-02 08:43:25.000000000 +0100
+--- new.orig/blockdev.c        2013-12-02 12:30:23.000000000 +0100
++++ new/blockdev.c     2013-12-02 12:54:24.000000000 +0100
 @@ -1932,7 +1932,7 @@
      }
  
      backup_start(bs, target_bs, speed, sync, on_source_error, on_target_error,
 -                 block_job_cb, bs, &local_err);
-+                 NULL, block_job_cb, bs, &local_err);
++                 NULL, block_job_cb, bs, false, &local_err);
      if (local_err != NULL) {
          bdrv_unref(target_bs);
          error_propagate(errp, local_err);
 Index: new/include/block/block_int.h
 ===================================================================
---- new.orig/include/block/block_int.h 2013-11-27 10:51:33.000000000 +0100
-+++ new/include/block/block_int.h      2013-12-02 07:40:35.000000000 +0100
+--- new.orig/include/block/block_int.h 2013-12-02 12:30:23.000000000 +0100
++++ new/include/block/block_int.h      2013-12-02 12:52:21.000000000 +0100
 @@ -54,6 +54,9 @@
  #define BLOCK_OPT_LAZY_REFCOUNTS    "lazy_refcounts"
  #define BLOCK_OPT_ADAPTER_TYPE      "adapter_type"
@@ -139,11 +145,13 @@ Index: new/include/block/block_int.h
  typedef struct BdrvTrackedRequest {
      BlockDriverState *bs;
      int64_t sector_num;
-@@ -427,6 +430,7 @@
+@@ -427,7 +430,9 @@
                    int64_t speed, MirrorSyncMode sync_mode,
                    BlockdevOnError on_source_error,
                    BlockdevOnError on_target_error,
 +                  BackupDumpFunc *dump_cb,
                    BlockDriverCompletionFunc *cb, void *opaque,
++                  bool paused,
                    Error **errp);
  
+ #endif /* BLOCK_INT_H */