diff options
author | Takashi Kajinami <tkajinam@redhat.com> | 2023-02-21 17:30:13 +0900 |
---|---|---|
committer | Takashi Kajinami <tkajinam@redhat.com> | 2023-02-21 17:37:48 +0900 |
commit | ea5bab9b577b9ff2c9cf1a14f21a0a4873379212 (patch) | |
tree | c6ebee4189281a67fb3286d3579a41e46ee6e7d5 | |
parent | 64e25979a904e468e1e89d8727e9554662596acf (diff) | |
download | glance_store-ea5bab9b577b9ff2c9cf1a14f21a0a4873379212.tar.gz |
rbd: Disable rbd stores if libraries are not available
This ensures glance_store checks whether the dependent libraries (rbd
and rados) when adding rbd store and disables all rados stores in case
these libraries are not available.
This avoid ugly error (eg. AttributeError) caused by missing libraries.
Change-Id: I673473aa8b540c084ce3a4934e8be7069f13e77f
-rw-r--r-- | glance_store/_drivers/rbd.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/glance_store/_drivers/rbd.py b/glance_store/_drivers/rbd.py index a9409e9..f45a909 100644 --- a/glance_store/_drivers/rbd.py +++ b/glance_store/_drivers/rbd.py @@ -318,6 +318,13 @@ class Store(driver.Store): this method. If the store was not able to successfully configure itself, it should raise `exceptions.BadStoreConfiguration` """ + if rbd is None or rados is None: + reason = _("The required libraries(rbd and rados) are not " + "available") + LOG.error(reason) + raise exceptions.BadStoreConfiguration(store_name='rbd', + reason=reason) + try: if self.backend_group: chunk = getattr(self.conf, |