]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
backup: do not report errors to the VM when backup fails
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 26 Mar 2014 07:53:17 +0000 (08:53 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 26 Mar 2014 07:54:24 +0000 (08:54 +0100)
debian/changelog
debian/patches/backup-do-not-return-errors-in-dump-callback.patch [new file with mode: 0644]
debian/patches/series

index 6b9ccde122a4a1f027ddb9d2a7fe1d0d250a1cc9..75c3c88173d3490fcfff8c13ea9d04dab7759506 100644 (file)
@@ -1,6 +1,8 @@
 pve-qemu-kvm (1.7-5) unstable; urgency=low
 
   * update to 1.7.1
+  
+  * backup: do not report errors to the VM when backup fails.
 
  -- Proxmox Support Team <support@proxmox.com>  Wed, 26 Mar 2014 06:37:55 +0100
 
diff --git a/debian/patches/backup-do-not-return-errors-in-dump-callback.patch b/debian/patches/backup-do-not-return-errors-in-dump-callback.patch
new file mode 100644 (file)
index 0000000..2d69274
--- /dev/null
@@ -0,0 +1,71 @@
+The backup dump_cb should always return success. Else the original write
+does not succeed and the VM gets notified. 
+
+We simply report success and cancel the backup job instead.
+
+
+Index: new/blockdev.c
+===================================================================
+--- new.orig/blockdev.c        2014-03-26 06:50:24.000000000 +0100
++++ new/blockdev.c     2014-03-26 08:44:29.000000000 +0100
+@@ -1772,6 +1772,11 @@
+ {
+     PVEBackupDevInfo *di = opaque;
++    int size = n_sectors * BDRV_SECTOR_SIZE;
++    if (backup_state.cancel) {
++        return size; // return success
++    }
++
+     if (sector_num & 0x7f) {
+         if (!backup_state.error) {
+             error_setg(&backup_state.error,
+@@ -1782,7 +1787,6 @@
+     }
+     int64_t cluster_num = sector_num >> 7;
+-    int size = n_sectors * BDRV_SECTOR_SIZE;
+     int ret = -1;
+@@ -1790,17 +1794,27 @@
+         size_t zero_bytes = 0;
+         ret = vma_writer_write(backup_state.vmaw, di->dev_id, cluster_num,
+                                buf, &zero_bytes);
+-        backup_state.zero_bytes += zero_bytes;
++        if (ret < 0) {
++            if (!backup_state.error) {
++                error_setg(&backup_state.error, "vma_writer_write error %d", ret);
++            }
++            if (di->bs && di->bs->job) {
++                block_job_cancel(di->bs->job);
++            }
++        } else {
++            backup_state.zero_bytes += zero_bytes;
++            backup_state.transferred += size;
++        }
+     } else {
+-        ret = size;
+         if (!buf) {
+             backup_state.zero_bytes += size;
+         }
++        backup_state.transferred += size;
+     }
+-    backup_state.transferred += size;
++    // Note: always return success, because we want that writes succeed anyways.
+-    return ret;
++    return size;
+ }
+ static void pvebackup_cleanup(void)
+@@ -1872,7 +1886,7 @@
+             BlockJob *job = di->bs->job;
+             if (job) {
+                 if (!di->completed) {
+-                    block_job_cancel_sync(job);
++                     block_job_cancel_sync(job);
+                 }
+             }
+         }
index ab4526e15be1a5adf3f531d835af6d81a639dd35..5368bc3570f7a245e362627ce98576f15b6d509a 100644 (file)
@@ -19,5 +19,6 @@ backup-vma-restore-tolerate-a-size-difference-up-to-4M.patch
 backup-modify-job-api.patch
 backup-add-pve-monitor-commands.patch
 backup-add-dir-format.patch
+backup-do-not-return-errors-in-dump-callback.patch
 internal-snapshot-async.patch
 disable-efi-enable-pxe-roms.patch