[PATCH 2/9] virStorageFileGetMetadataRecurse: Remove impossible error report

Peter Krempa pkrempa at redhat.com
Mon Feb 17 17:13:52 UTC 2020


We call virStorageFileSupportsBackingChainTraversal which already checks
that the 'storageFileRead' callback is non-NULL, which in turn means
that virStorageFileRead will not return -2.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virstoragefile.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 4d2e39246c..7aeeab0739 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -5003,15 +5003,8 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         goto cleanup;

     if ((headerLen = virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER,
-                                        &buf)) < 0) {
-        if (headerLen == -2)
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("storage file reading is not supported for "
-                             "storage type %s (protocol: %s)"),
-                           virStorageTypeToString(src->type),
-                           virStorageNetProtocolTypeToString(src->protocol));
+                                        &buf)) < 0)
         goto cleanup;
-    }

     if (virStorageFileGetMetadataInternal(src, buf, headerLen,
                                           &backingFormat) < 0)
-- 
2.24.1




More information about the libvir-list mailing list