Add volume_backend_name to render in cinder.conf

Also enforces required config parameters

Change-Id: Idd148b98b3025b1f9b33c3cff83b5d12e0059717
This commit is contained in:
Gustavo Sanchez 2022-01-25 17:19:57 -04:00 committed by Aurelien Lourot
parent 9f9ebd832e
commit 548dff762c
2 changed files with 13 additions and 2 deletions

View File

@ -1,8 +1,13 @@
options:
volume-backend-name:
type: string
default: cinder_solidfire
description: Service name to present to Cinder
description: |
Volume backend name for the backend. The default value is the
application name in the Juju model, e.g. "cinder-sf-mybackend"
if it's deployed as `juju deploy cinder-solidfire cinder-sf-mybackend`.
A common backend name can be set to multiple backends with the
same characters so that those can be treated as a single virtual
backend associated with a single volume type.
san-ip:
type: string
default: !!null ""

View File

@ -33,6 +33,9 @@ class CinderSolidfireCharm(CinderStoragePluginCharm):
stateless = False
active_active = False
mandatory_config = [
'san-ip', 'san-login', 'san-password']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._stored.is_started = True
@ -43,9 +46,12 @@ class CinderSolidfireCharm(CinderStoragePluginCharm):
sf_volume_prefix = str(uuid.uuid4()) if cget(
'volume-prefix') == "UUID" else cget('volume-prefix')
volume_backend_name = cget(
'volume-backend-name') or self.framework.model.app.name
raw_options = [
('volume_driver', VOLUME_DRIVER),
('volume_backend_name', volume_backend_name),
('san_ip', cget('san-ip')),
('san_login', cget('san-login')),
('san_password', cget('san-password')),