return default value if no storage backend enable

if no storage backend enable, once upload stx-openstack application
the sysinv will crash and upload abort
AttributeError: 'NoneType' object has no attribute 'capabilities'
to avoid this ,return default value if no storage backend

Change-Id: I00b561ff297a1e2567e591f82bbc5b8ba8bd36f4
Closes-Bug: 1881706
Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
Sun Austin 2020-06-02 14:46:51 +08:00
parent c4169e629c
commit 1038873196
1 changed files with 5 additions and 0 deletions

View File

@ -307,6 +307,11 @@ class StorageBackendConfig(object):
constants.CINDER_BACKEND_CEPH
)
# if no backend is added, return default value
if not ceph_backend:
LOG.warning("No Ceph storage backend config")
return 0, 0
pool_size = int(ceph_backend.capabilities[
constants.CEPH_BACKEND_REPLICATION_CAP])
pool_min_size = int(ceph_backend.capabilities[