Fix the return value status comparison checking for call to
volStorageBackendRBDRefreshVolInfo introduced by commit id f46d137e.

we only should fail when the return is < 0. -ENOENT, -ETIMEDOUT will
ignore according commit id f46d137e.

Signed-off-by: Yi Li <y...@winhong.com>
---
 src/storage/storage_backend_rbd.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/storage/storage_backend_rbd.c 
b/src/storage/storage_backend_rbd.c
index 81f7cd5..5f14156 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -412,7 +412,7 @@ volStorageBackendRBDGetFeatures(rbd_image_t image,
     if ((rc = rbd_get_features(image, features)) < 0) {
         virReportSystemError(-rc, _("failed to get the features of RBD image "
                                  "%s"), volname);
-        return -1;
+        return rc;
     }
 
     return 0;
@@ -430,7 +430,7 @@ volStorageBackendRBDGetFlags(rbd_image_t image,
         virReportSystemError(-rc,
                              _("failed to get the flags of RBD image %s"),
                              volname);
-        return -1;
+        return rc;
     }
 
     return 0;
@@ -469,7 +469,7 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr vol,
                                &allocation)) < 0) {
         virReportSystemError(-rc, _("failed to iterate RBD image '%s'"),
                              vol->name);
-        return -1;
+        return rc;
     }
 
     VIR_DEBUG("Found %zu bytes allocated for RBD image %s",
@@ -519,24 +519,28 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr 
vol,
     uint64_t flags;
 
     if ((rc = rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL)) < 0) {
-        ret = -rc;
+        ret = rc;
         virReportSystemError(-rc, _("failed to open the RBD image '%s'"),
                              vol->name);
         goto cleanup;
     }
 
     if ((rc = rbd_stat(image, &info, sizeof(info))) < 0) {
-        ret = -rc;
+        ret = rc;
         virReportSystemError(-rc, _("failed to stat the RBD image '%s'"),
                              vol->name);
         goto cleanup;
     }
 
-    if (volStorageBackendRBDGetFeatures(image, vol->name, &features) < 0)
+    if ((rc = volStorageBackendRBDGetFeatures(image, vol->name, &features)) < 
0) {
+        ret = rc;
         goto cleanup;
+    }
 
-    if (volStorageBackendRBDGetFlags(image, vol->name, &flags) < 0)
+    if ((rc = volStorageBackendRBDGetFlags(image, vol->name, &flags)) < 0) {
+        ret = rc;
         goto cleanup;
+    }
 
     vol->target.capacity = info.size;
     vol->type = VIR_STORAGE_VOL_NETWORK;
@@ -549,8 +553,10 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
                   "Querying for actual allocation",
                   def->source.name, vol->name);
 
-        if (virStorageBackendRBDSetAllocation(vol, image, &info) < 0)
+        if ((rc = virStorageBackendRBDSetAllocation(vol, image, &info)) < 0) {
+            ret = rc;
             goto cleanup;
+       }
     } else {
         vol->target.allocation = info.obj_size * info.num_objs;
     }
-- 
2.7.5




--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to