From 7d0363fc5a74a72bf1b938684bbe3aef97eece17 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 26 Mar 2014 08:53:17 +0100 Subject: [PATCH] backup: do not report errors to the VM when backup fails --- debian/changelog | 2 + ...o-not-return-errors-in-dump-callback.patch | 71 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 74 insertions(+) create mode 100644 debian/patches/backup-do-not-return-errors-in-dump-callback.patch diff --git a/debian/changelog b/debian/changelog index 6b9ccde..75c3c88 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 index 0000000..2d69274 --- /dev/null +++ b/debian/patches/backup-do-not-return-errors-in-dump-callback.patch @@ -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); + } + } + } diff --git a/debian/patches/series b/debian/patches/series index ab4526e..5368bc3 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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 -- 2.39.5