yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-backup-Improve-error-for-bdrv_getlength-failure.patch

ddf19c
From fba183faf8ce819262a1a47f8531ea68051cdce7 Mon Sep 17 00:00:00 2001
ddf19c
From: Kevin Wolf <kwolf@redhat.com>
ddf19c
Date: Wed, 3 Jun 2020 16:03:19 +0100
ddf19c
Subject: [PATCH 20/26] backup: Improve error for bdrv_getlength() failure
ddf19c
ddf19c
RH-Author: Kevin Wolf <kwolf@redhat.com>
ddf19c
Message-id: <20200603160325.67506-6-kwolf@redhat.com>
ddf19c
Patchwork-id: 97103
ddf19c
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 05/11] backup: Improve error for bdrv_getlength() failure
ddf19c
Bugzilla: 1778593
ddf19c
RH-Acked-by: Eric Blake <eblake@redhat.com>
ddf19c
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ddf19c
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
ddf19c
ddf19c
bdrv_get_device_name() will be an empty string with modern management
ddf19c
tools that don't use -drive. Use bdrv_get_device_or_node_name() instead
ddf19c
so that the node name is used if the BlockBackend is anonymous.
ddf19c
ddf19c
While at it, start with upper case to make the message consistent with
ddf19c
the rest of the function.
ddf19c
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ddf19c
Reviewed-by: Alberto Garcia <berto@igalia.com>
ddf19c
Message-Id: <20200430142755.315494-3-kwolf@redhat.com>
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
(cherry picked from commit 58226634c4b02af7b10862f7fbd3610a344bfb7f)
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 block/backup.c | 4 ++--
ddf19c
 1 file changed, 2 insertions(+), 2 deletions(-)
ddf19c
ddf19c
diff --git a/block/backup.c b/block/backup.c
ddf19c
index ec50946..7c6ddd2 100644
ddf19c
--- a/block/backup.c
ddf19c
+++ b/block/backup.c
ddf19c
@@ -408,8 +408,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
ddf19c
 
ddf19c
     len = bdrv_getlength(bs);
ddf19c
     if (len < 0) {
ddf19c
-        error_setg_errno(errp, -len, "unable to get length for '%s'",
ddf19c
-                         bdrv_get_device_name(bs));
ddf19c
+        error_setg_errno(errp, -len, "Unable to get length for '%s'",
ddf19c
+                         bdrv_get_device_or_node_name(bs));
ddf19c
         goto error;
ddf19c
     }
ddf19c
 
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c