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;
virReportSystemError(-rc,
_("failed to get the flags of RBD image %s"),
volname);
- return -1;
+ return rc;
}
return 0;
&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",
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;
"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;
}