mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-30 18:50:18 +03:00
storage: Fix volStorageBackendRBDRefreshVolInfo function return errors
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. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Yi Li <yili@winhong.com>
This commit is contained in:
parent
c898bda969
commit
a9eaaccd22
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user