Realizing that vmastat.errmsg already contains "vma_writer_register_stream" and we're not losing any info here:

Reviewed-by: Stefan Reiter <s.rei...@proxmox.com>

On 19/03/2020 11:47, Dominic Jäger wrote:
Also print the reason why the function vma_writer_register_stream failed to
help debug errors like in [0].

[0] 
https://forum.proxmox.com/threads/backup-error-vma_writer_register_stream-drive-scsi0-failed-pve-6-1-7.65925/

Signed-off-by: Dominic Jäger <d.jae...@proxmox.com>
---
  .../0029-PVE-Backup-add-vma-backup-format-code.patch  | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/debian/patches/pve/0029-PVE-Backup-add-vma-backup-format-code.patch 
b/debian/patches/pve/0029-PVE-Backup-add-vma-backup-format-code.patch
index c7a4275..0861a3f 100644
--- a/debian/patches/pve/0029-PVE-Backup-add-vma-backup-format-code.patch
+++ b/debian/patches/pve/0029-PVE-Backup-add-vma-backup-format-code.patch
@@ -8,9 +8,9 @@ Subject: [PATCH 29/32] PVE-Backup: add vma backup format code
   Makefile.objs |   1 +
   vma-reader.c  | 857 ++++++++++++++++++++++++++++++++++++++++++++++++++
   vma-writer.c  | 771 +++++++++++++++++++++++++++++++++++++++++++++
- vma.c         | 837 ++++++++++++++++++++++++++++++++++++++++++++++++
+ vma.c         | 838 ++++++++++++++++++++++++++++++++++++++++++++++++
   vma.h         | 150 +++++++++
- 6 files changed, 2618 insertions(+), 1 deletion(-)
+ 6 files changed, 2619 insertions(+), 1 deletion(-)
   create mode 100644 vma-reader.c
   create mode 100644 vma-writer.c
   create mode 100644 vma.c
@@ -1694,7 +1694,7 @@ new file mode 100644
  index 0000000000..a82752448a
  --- /dev/null
  +++ b/vma.c
-@@ -0,0 +1,837 @@
+@@ -0,0 +1,838 @@
  +/*
  + * VMA: Virtual Machine Archive
  + *
@@ -2330,6 +2330,7 @@ index 0000000000..a82752448a
  +    }
  +
  +    int devcount = 0;
++    VmaStatus vmastat;
  +    while (optind < argc) {
  +        const char *path = argv[optind++];
  +        char *devname = NULL;
@@ -2347,7 +2348,8 @@ index 0000000000..a82752448a
  +        int dev_id = vma_writer_register_stream(vmaw, devname, size);
  +        if (dev_id <= 0) {
  +            unlink(archivename);
-+            g_error("vma_writer_register_stream '%s' failed", devname);
++            vma_writer_get_status(vmaw, &vmastat);
++            g_error("error for device '%s': %s", devname, vmastat.errmsg);
  +        }
  +
  +        BackupJob *job = g_new0(BackupJob, 1);
@@ -2360,7 +2362,6 @@ index 0000000000..a82752448a
  +        qemu_coroutine_enter(co);
  +    }
  +
-+    VmaStatus vmastat;
  +    int percent = 0;
  +    int last_percent = -1;
  +


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to