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