render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
99cbc7
From 78d68159183b07c1ab1d148dc6ddd05abbf0c5f4 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <78d68159183b07c1ab1d148dc6ddd05abbf0c5f4@dist-git>
99cbc7
From: Peter Krempa <pkrempa@redhat.com>
99cbc7
Date: Fri, 16 Aug 2019 14:36:55 +0200
99cbc7
Subject: [PATCH] util: storagefile: Don't report errors from
99cbc7
 virStorageSourceUpdatePhysicalSize
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
virStorageSourceUpdatePhysicalSize is called only from
99cbc7
qemuDomainStorageUpdatePhysical and all callers of it reset the libvirt
99cbc7
error if -1 is returned.
99cbc7
99cbc7
Don't bother setting the error in the first place.
99cbc7
99cbc7
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
(cherry picked from commit b074363136ddcf1599c36f11b9f5a5fe45c5b3e5)
99cbc7
99cbc7
 Conflicts:
99cbc7
	src/util/virstoragefile.c:
99cbc7
         Code reformatting patch 34e9c29357e not backported so the
99cbc7
         context was different.
99cbc7
99cbc7
https: //bugzilla.redhat.com/show_bug.cgi?id=1724808
99cbc7
Message-Id: <a745996bdbc9be42461a8c023b821102a105ed66.1565958905.git.pkrempa@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/util/virstoragefile.c | 12 ++----------
99cbc7
 1 file changed, 2 insertions(+), 10 deletions(-)
99cbc7
99cbc7
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
99cbc7
index 099ff62f75..09dd8e3084 100644
99cbc7
--- a/src/util/virstoragefile.c
99cbc7
+++ b/src/util/virstoragefile.c
99cbc7
@@ -3699,7 +3699,7 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent)
99cbc7
  * To be called for domain storage source reporting as the volume code does
99cbc7
  * not set/use the 'type' field for the voldef->source.target
99cbc7
  *
99cbc7
- * Returns 0 on success, -1 on error.
99cbc7
+ * Returns 0 on success, -1 on error. No libvirt errors are reported.
99cbc7
  */
99cbc7
 int
99cbc7
 virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
99cbc7
@@ -3716,11 +3716,8 @@ virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
99cbc7
         break;
99cbc7
 
99cbc7
     case VIR_STORAGE_TYPE_BLOCK:
99cbc7
-        if ((end = lseek(fd, 0, SEEK_END)) == (off_t) -1) {
99cbc7
-            virReportSystemError(errno, _("failed to seek to end of '%s'"),
99cbc7
-                                 src->path);
99cbc7
+        if ((end = lseek(fd, 0, SEEK_END)) == (off_t) -1)
99cbc7
             return -1;
99cbc7
-        }
99cbc7
 
99cbc7
         src->physical = end;
99cbc7
         break;
99cbc7
@@ -3733,12 +3730,7 @@ virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
99cbc7
     case VIR_STORAGE_TYPE_VOLUME:
99cbc7
     case VIR_STORAGE_TYPE_NONE:
99cbc7
     case VIR_STORAGE_TYPE_LAST:
99cbc7
-        virReportError(VIR_ERR_INTERNAL_ERROR,
99cbc7
-                      _("cannot retrieve physical for path '%s' type '%s'"),
99cbc7
-                      NULLSTR(src->path),
99cbc7
-                      virStorageTypeToString(actual_type));
99cbc7
         return -1;
99cbc7
-        break;
99cbc7
     }
99cbc7
 
99cbc7
     return 0;
99cbc7
-- 
99cbc7
2.22.1
99cbc7