summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kajinami <tkajinam@redhat.com>2023-02-21 17:05:54 +0900
committerTakashi Kajinami <tkajinam@redhat.com>2023-02-21 08:32:06 +0000
commit572e73ef135106e8b1dd4378db183c565db2cfc9 (patch)
tree02dc2b3db90a1bc30a09f05f86c6e799341b2acf
parent64e25979a904e468e1e89d8727e9554662596acf (diff)
downloadglance_store-572e73ef135106e8b1dd4378db183c565db2cfc9.tar.gz
cinder: Disable cinder stores if cinderclient is not installed
Change Iec6ac7020f66f9f9728d6cf4452127b8d55a8b2d made cinderclient optional but it did not add proper validation while initializing a cinder store. This can cause ugly errors in case users tries to enable cinder stores without installing cinderclient. This ensures glance_store checks whether cinderclient is available and disables all cinder stores in case cinderclient is not available. Change-Id: Idb8abfdab9639b5b70ddddc3a76b1f1d24dd035d
-rw-r--r--glance_store/_drivers/cinder/store.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/glance_store/_drivers/cinder/store.py b/glance_store/_drivers/cinder/store.py
index 17fb96b..b587c7e 100644
--- a/glance_store/_drivers/cinder/store.py
+++ b/glance_store/_drivers/cinder/store.py
@@ -514,6 +514,12 @@ class Store(glance_store.driver.Store):
Check to verify if the volume types configured for the cinder store
exist in deployment and if not, log a warning.
"""
+ if cinderclient is None:
+ reason = _("cinderclient is not available.")
+ LOG.error(reason)
+ raise exceptions.BadStoreConfiguration(store_name="cinder",
+ reason=reason)
+
cinder_volume_type = self.store_conf.cinder_volume_type
if cinder_volume_type:
# NOTE: `cinder_volume_type` is configured, check