]> git.proxmox.com Git - pve-qemu-kvm.git/blobdiff - debian/patches/pve/0016-backup-vma-add-dir-format.patch
vma: don't use O_DIRECT on pipes
[pve-qemu-kvm.git] / debian / patches / pve / 0016-backup-vma-add-dir-format.patch
index 3a53dd389fbdcb0cca007060ae18fbcb0006c6db..3d36d5ff2d1b3a7765c247887df82dc187be9240 100644 (file)
@@ -1,21 +1,21 @@
-From 210be0fc498989e7b029de90b9d2599fdcc343d3 Mon Sep 17 00:00:00 2001
+From 99a526d92531d64ff0c31a83d0d55f38651a32a5 Mon Sep 17 00:00:00 2001
 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
 Date: Wed, 9 Dec 2015 15:21:54 +0100
-Subject: [PATCH 16/47] backup: vma: add dir format
+Subject: [PATCH 16/48] backup: vma: add dir format
 
 ---
- blockdev.c       | 124 +++++++++++++++++++++++++++++++++++++++++--------------
+ blockdev.c       | 137 ++++++++++++++++++++++++++++++++++++++++---------------
  hmp-commands.hx  |   8 ++--
  hmp.c            |   4 +-
  qapi-schema.json |   2 +-
  vma.c            |   2 +-
- 5 files changed, 103 insertions(+), 37 deletions(-)
+ 5 files changed, 111 insertions(+), 42 deletions(-)
 
 diff --git a/blockdev.c b/blockdev.c
-index 5417bb0..d8b1db8 100644
+index 3e5c9ce..af1b9d4 100644
 --- a/blockdev.c
 +++ b/blockdev.c
-@@ -3001,6 +3001,8 @@ typedef struct PVEBackupDevInfo {
+@@ -3007,6 +3007,8 @@ typedef struct PVEBackupDevInfo {
      uint8_t dev_id;
      //bool started;
      bool completed;
@@ -24,7 +24,7 @@ index 5417bb0..d8b1db8 100644
  } PVEBackupDevInfo;
  
  static void pvebackup_run_next_job(void);
-@@ -3069,8 +3071,6 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -3075,8 +3077,6 @@ static void pvebackup_complete_cb(void *opaque, int ret)
  {
      PVEBackupDevInfo *di = opaque;
  
@@ -33,7 +33,7 @@ index 5417bb0..d8b1db8 100644
      di->completed = true;
  
      if (ret < 0 && !backup_state.error) {
-@@ -3081,8 +3081,11 @@ static void pvebackup_complete_cb(void *opaque, int ret)
+@@ -3087,8 +3087,11 @@ static void pvebackup_complete_cb(void *opaque, int ret)
      BlockDriverState *bs = di->bs;
  
      di->bs = NULL;
@@ -46,7 +46,7 @@ index 5417bb0..d8b1db8 100644
  
      block_job_cb(bs, ret);
  
-@@ -3162,6 +3165,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+@@ -3168,6 +3171,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
  {
      BlockBackend *blk;
      BlockDriverState *bs = NULL;
@@ -54,7 +54,15 @@ index 5417bb0..d8b1db8 100644
      Error *local_err = NULL;
      uuid_t uuid;
      VmaWriter *vmaw = NULL;
-@@ -3179,11 +3183,6 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+@@ -3175,6 +3179,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+     GList *di_list = NULL;
+     GList *l;
+     UuidInfo *uuid_info;
++    BlockJob *job;
+     if (backup_state.di_list) {
+         error_set(errp, ERROR_CLASS_GENERIC_ERROR,
+@@ -3185,11 +3190,6 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
      /* Todo: try to auto-detect format based on file name */
      format = has_format ? format : BACKUP_FORMAT_VMA;
  
@@ -66,7 +74,7 @@ index 5417bb0..d8b1db8 100644
      if (has_devlist) {
          devs = g_strsplit_set(devlist, ",;:", -1);
  
-@@ -3252,27 +3251,62 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+@@ -3258,27 +3258,62 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
  
      uuid_generate(uuid);
  
@@ -145,7 +153,7 @@ index 5417bb0..d8b1db8 100644
      }
  
      /* add configuration file to archive */
-@@ -3285,12 +3319,27 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+@@ -3291,12 +3326,27 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
              goto err;
          }
  
@@ -178,16 +186,37 @@ index 5417bb0..d8b1db8 100644
          g_free(cdata);
      }
  
-@@ -3330,7 +3379,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+@@ -3335,15 +3385,16 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+     while (l) {
          PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
          l = g_list_next(l);
+-
+-        backup_job_create(NULL, di->bs, NULL, speed, MIRROR_SYNC_MODE_FULL, NULL,
+-                          BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
+-                          pvebackup_dump_cb, pvebackup_complete_cb, di,
+-                          1, NULL, &local_err);
+-        if (local_err != NULL) {
++        job = backup_job_create(NULL, di->bs, di->target, speed, MIRROR_SYNC_MODE_FULL, NULL,
++                                false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
++                                BLOCK_JOB_DEFAULT,
++                                pvebackup_dump_cb, pvebackup_complete_cb, di,
++                                1, NULL, &local_err);
++        if (!job || local_err != NULL) {
+             error_setg(&backup_state.error, "backup_job_create failed");
+             pvebackup_cancel(NULL);
+         }
++        block_job_start(job);
+     }
+     if (!backup_state.error) {
+@@ -3352,14 +3403,24 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format,
+     uuid_info = g_malloc0(sizeof(*uuid_info));
+     uuid_info->UUID = g_strdup(backup_state.uuid_str);
++
+     return uuid_info;
  
--        backup_start(NULL, di->bs, NULL, speed, MIRROR_SYNC_MODE_FULL, NULL,
-+        backup_start(NULL, di->bs, di->target, speed, MIRROR_SYNC_MODE_FULL, NULL,
-                      BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
-                      pvebackup_dump_cb, pvebackup_complete_cb, di,
-                      1, NULL, &local_err);
-@@ -3352,8 +3401,17 @@ err:
+ err:
  
      l = di_list;
      while (l) {
@@ -206,7 +235,7 @@ index 5417bb0..d8b1db8 100644
      }
      g_list_free(di_list);
  
-@@ -3367,6 +3425,10 @@ err:
+@@ -3373,6 +3434,10 @@ err:
          unlink(backup_file);
      }
  
@@ -218,7 +247,7 @@ index 5417bb0..d8b1db8 100644
  }
  
 diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 8f2f3e0..0e20ef9 100644
+index aea39d0..7288203 100644
 --- a/hmp-commands.hx
 +++ b/hmp-commands.hx
 @@ -89,9 +89,11 @@ ETEXI
@@ -233,14 +262,14 @@ index 8f2f3e0..0e20ef9 100644
 +        .help       = "create a VM Backup."
 +                  "\n\t\t\t Use -d to dump data into a directory instead"
 +                  "\n\t\t\t of using VMA format.",
-         .mhandler.cmd = hmp_backup,
+         .cmd = hmp_backup,
      },
  
 diff --git a/hmp.c b/hmp.c
-index 95da164..c23cf2f 100644
+index c685ba5..465d7fa 100644
 --- a/hmp.c
 +++ b/hmp.c
-@@ -1544,11 +1544,13 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
+@@ -1664,11 +1664,13 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
  {
      Error *error = NULL;
  
@@ -256,10 +285,10 @@ index 95da164..c23cf2f 100644
  
      hmp_handle_error(mon, &error);
 diff --git a/qapi-schema.json b/qapi-schema.json
-index 89d9ea6..147137d 100644
+index 059cbfc..1127f2c 100644
 --- a/qapi-schema.json
 +++ b/qapi-schema.json
-@@ -395,7 +395,7 @@
+@@ -609,7 +609,7 @@
  # @vma: Proxmox vma backup format
  ##
  { 'enum': 'BackupFormat',
@@ -269,10 +298,10 @@ index 89d9ea6..147137d 100644
  ##
  # @backup:
 diff --git a/vma.c b/vma.c
-index 79bdd00..c88a4358 100644
+index 8925407..1ffaced 100644
 --- a/vma.c
 +++ b/vma.c
-@@ -263,7 +263,7 @@ static int extract_content(int argc, char **argv)
+@@ -264,7 +264,7 @@ static int extract_content(int argc, char **argv)
              g_free(statefn);
          } else if (di) {
              char *devfn = NULL;