]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
fix for empty vma archives (config only)
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Sep 2015 09:25:25 +0000 (11:25 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Sep 2015 09:25:25 +0000 (11:25 +0200)
We need to run the event loop correctly.

debian/patches/backup-vma-allow-empty-backups.patch

index ea71d620303796e8893821c318b03acc91834e95..0fa4eefb080a81ae43944d3a73ebdd0d29bf0e51 100644 (file)
@@ -5,9 +5,9 @@ user set backup=no to all VM disks.
 
 Index: new/vma-reader.c
 ===================================================================
---- new.orig/vma-reader.c      2014-11-20 12:17:11.000000000 +0100
-+++ new/vma-reader.c   2014-11-20 12:17:39.000000000 +0100
-@@ -334,11 +334,6 @@
+--- new.orig/vma-reader.c
++++ new/vma-reader.c
+@@ -334,11 +334,6 @@ static int vma_reader_read_head(VmaReade
          }
      }
  
@@ -19,7 +19,7 @@ Index: new/vma-reader.c
      for (i = 0; i < VMA_MAX_CONFIGS; i++) {
          uint32_t name_ptr = GUINT32_FROM_BE(h->config_names[i]);
          uint32_t data_ptr = GUINT32_FROM_BE(h->config_data[i]);
-@@ -830,16 +825,20 @@
+@@ -830,16 +825,20 @@ static int vma_reader_restore_full(VmaRe
      }
  
      if (verbose) {
@@ -52,9 +52,9 @@ Index: new/vma-reader.c
      return ret;
 Index: new/vma-writer.c
 ===================================================================
---- new.orig/vma-writer.c      2014-11-20 12:17:23.000000000 +0100
-+++ new/vma-writer.c   2014-11-20 12:17:39.000000000 +0100
-@@ -258,7 +258,7 @@
+--- new.orig/vma-writer.c
++++ new/vma-writer.c
+@@ -258,7 +258,7 @@ vma_queue_write(VmaWriter *vmaw, const v
      }
  
      vmaw->co_writer = NULL;
@@ -63,7 +63,7 @@ Index: new/vma-writer.c
      return (done == bytes) ? bytes : -1;
  }
  
-@@ -382,10 +382,6 @@
+@@ -382,10 +382,6 @@ static int coroutine_fn vma_write_header
      time_t ctime = time(NULL);
      head->ctime = GUINT64_TO_BE(ctime);
  
@@ -74,7 +74,7 @@ Index: new/vma-writer.c
      for (i = 0; i < VMA_MAX_CONFIGS; i++) {
          head->config_names[i] = GUINT32_TO_BE(vmaw->config_names[i]);
          head->config_data[i] = GUINT32_TO_BE(vmaw->config_data[i]);
-@@ -502,6 +498,23 @@
+@@ -502,6 +498,23 @@ static int vma_count_open_streams(VmaWri
      return open_drives;
  }
  
@@ -98,7 +98,7 @@ Index: new/vma-writer.c
  /**
   * all jobs should call this when there is no more data
   * Returns: number of remaining stream (0 ==> finished)
-@@ -529,12 +542,7 @@
+@@ -529,12 +542,7 @@ vma_writer_close_stream(VmaWriter *vmaw,
  
      if (open_drives <= 0) {
          DPRINTF("vma_writer_set_status all drives completed\n");
@@ -114,9 +114,9 @@ Index: new/vma-writer.c
      return open_drives;
 Index: new/vma.c
 ===================================================================
---- new.orig/vma.c     2014-11-20 12:17:11.000000000 +0100
-+++ new/vma.c  2014-11-20 12:17:39.000000000 +0100
-@@ -33,7 +33,7 @@
+--- new.orig/vma.c
++++ new/vma.c
+@@ -33,7 +33,7 @@ static void help(void)
          "\n"
          "vma list <filename>\n"
          "vma config <filename> [-c config]\n"
@@ -125,7 +125,7 @@ Index: new/vma.c
          "vma extract <filename> [-r <fifo>] <targetdir>\n"
          "vma verify <filename> [-v]\n"
          ;
-@@ -401,6 +401,18 @@
+@@ -401,6 +401,18 @@ typedef struct BackupJob {
  
  #define BACKUP_SECTORS_PER_CLUSTER (VMA_CLUSTER_SIZE / BDRV_SECTOR_SIZE)
  
@@ -144,7 +144,7 @@ Index: new/vma.c
  static void coroutine_fn backup_run(void *opaque)
  {
      BackupJob *job = (BackupJob *)opaque;
-@@ -474,8 +486,8 @@
+@@ -474,8 +486,8 @@ static int create_archive(int argc, char
      }
  
  
@@ -155,7 +155,7 @@ Index: new/vma.c
          help();
      }
  
-@@ -510,11 +522,11 @@
+@@ -510,11 +522,11 @@ static int create_archive(int argc, char
          l = g_list_next(l);
      }
  
@@ -169,7 +169,7 @@ Index: new/vma.c
  
          BlockDriver *drv = NULL;
          Error *errp = NULL;
-@@ -546,37 +558,42 @@
+@@ -546,37 +558,49 @@ static int create_archive(int argc, char
      int percent = 0;
      int last_percent = -1;
  
@@ -235,14 +235,21 @@ Index: new/vma.c
 +    } else {
 +        Coroutine *co = qemu_coroutine_create(backup_run_empty);
 +        qemu_coroutine_enter(co, vmaw);
++      while (1) {
++          main_loop_wait(false);
++          vma_writer_get_status(vmaw, &vmastat);
++          if (vmastat.closed) {
++                  break;
++            }
++      }
      }
  
      bdrv_drain_all();
 Index: new/vma.h
 ===================================================================
---- new.orig/vma.h     2014-11-20 12:17:11.000000000 +0100
-+++ new/vma.h  2014-11-20 12:17:39.000000000 +0100
-@@ -128,6 +128,7 @@
+--- new.orig/vma.h
++++ new/vma.h
+@@ -128,6 +128,7 @@ int64_t coroutine_fn vma_writer_write(Vm
                                        size_t *zero_bytes);
  
  int coroutine_fn vma_writer_close_stream(VmaWriter *vmaw, uint8_t dev_id);