vma_writer: Display more error information

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.jaeger@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
Dominic Jäger 2020-03-19 11:47:45 +01:00 committed by Thomas Lamprecht
parent 1be32c854f
commit 66e3df5d45

View File

@ -8,9 +8,9 @@ Subject: [PATCH 29/32] PVE-Backup: add vma backup format code
Makefile.objs | 1 + Makefile.objs | 1 +
vma-reader.c | 857 ++++++++++++++++++++++++++++++++++++++++++++++++++ vma-reader.c | 857 ++++++++++++++++++++++++++++++++++++++++++++++++++
vma-writer.c | 771 +++++++++++++++++++++++++++++++++++++++++++++ vma-writer.c | 771 +++++++++++++++++++++++++++++++++++++++++++++
vma.c | 837 ++++++++++++++++++++++++++++++++++++++++++++++++ vma.c | 838 ++++++++++++++++++++++++++++++++++++++++++++++++
vma.h | 150 +++++++++ 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-reader.c
create mode 100644 vma-writer.c create mode 100644 vma-writer.c
create mode 100644 vma.c create mode 100644 vma.c
@ -1694,7 +1694,7 @@ new file mode 100644
index 0000000000..a82752448a index 0000000000..a82752448a
--- /dev/null --- /dev/null
+++ b/vma.c +++ b/vma.c
@@ -0,0 +1,837 @@ @@ -0,0 +1,838 @@
+/* +/*
+ * VMA: Virtual Machine Archive + * VMA: Virtual Machine Archive
+ * + *
@ -2330,6 +2330,7 @@ index 0000000000..a82752448a
+ } + }
+ +
+ int devcount = 0; + int devcount = 0;
+ VmaStatus vmastat;
+ while (optind < argc) { + while (optind < argc) {
+ const char *path = argv[optind++]; + const char *path = argv[optind++];
+ char *devname = NULL; + char *devname = NULL;
@ -2347,7 +2348,8 @@ index 0000000000..a82752448a
+ int dev_id = vma_writer_register_stream(vmaw, devname, size); + int dev_id = vma_writer_register_stream(vmaw, devname, size);
+ if (dev_id <= 0) { + if (dev_id <= 0) {
+ unlink(archivename); + 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); + BackupJob *job = g_new0(BackupJob, 1);
@ -2360,7 +2362,6 @@ index 0000000000..a82752448a
+ qemu_coroutine_enter(co); + qemu_coroutine_enter(co);
+ } + }
+ +
+ VmaStatus vmastat;
+ int percent = 0; + int percent = 0;
+ int last_percent = -1; + int last_percent = -1;
+ +