Adds skip logic to non-leader units

Non leader units will skip the event handling if Ceph dashboard
is not enabled by the leader yet.

Some test bundle fixes.

Partial-Bug: #1952282
Change-Id: I743e50663ee85c91af4962d7d100e2fd48efa48c
This commit is contained in:
utkarshbhatthere 2023-06-01 15:57:49 +05:30 committed by Luciano Lo Giudice
parent f42b07f4bd
commit f5684e545d
8 changed files with 30 additions and 25 deletions

View File

@ -415,14 +415,19 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
"Skipping charm option {}, not supported".format(
option.charm_option_name))
def _configure_dashboard(self, _) -> None:
def _configure_dashboard(self, event) -> None:
"""Configure dashboard"""
self.request_certificates()
if not self.mon.mons_ready:
logging.info("Not configuring dashboard, mons not ready")
return
if self.unit.is_leader() and not ceph_utils.is_dashboard_enabled():
ceph_utils.mgr_enable_dashboard()
if not ceph_utils.is_dashboard_enabled():
if self.unit.is_leader():
ceph_utils.mgr_enable_dashboard()
else:
logging.info("Dashboard not enabled, deferring event.")
return
self._apply_ceph_config_from_charm_config()
self._configure_tls()
ceph_utils.mgr_config_set(

View File

@ -7,7 +7,7 @@ applications:
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
source: *openstack-origin
osd-devices: '/dev/test-non-existent'
@ -29,10 +29,10 @@ applications:
num_units: 3
options:
source: *openstack-origin
channel: latest/edge
channel: 8.0/edge
vault-mysql-router:
charm: ch:mysql-router
channel: latest/edge
channel: 8.0/edge
ceph-dashboard:
charm: ../../ceph-dashboard.charm
options:
@ -62,20 +62,20 @@ applications:
num_units: 3
options:
source: *openstack-origin
channel: latest/edge
channel: quincy/edge
ceph-fs:
charm: ch:ceph-fs
num_units: 1
options:
source: *openstack-origin
channel: latest/edge
channel: quincy/edge
ceph-iscsi:
charm: ch:ceph-iscsi
num_units: 2
options:
source: *openstack-origin
gateway-metadata-pool: iscsi-foo-metadata
channel: latest/edge
channel: quincy/edge
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'

View File

@ -5,7 +5,7 @@ applications:
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
osd-devices: '/dev/test-non-existent'
channel: latest/edge

View File

@ -7,7 +7,7 @@ applications:
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
osd-devices: '/dev/test-non-existent'
source: *openstack-origin
@ -27,10 +27,10 @@ applications:
charm: ch:mysql-innodb-cluster
constraints: mem=3072M
num_units: 3
channel: latest/edge
channel: 8.0/edge
vault-mysql-router:
charm: ch:mysql-router
channel: latest/edge
channel: 8.0/edge
ceph-dashboard:
charm: ../../ceph-dashboard.charm
options:

View File

@ -8,7 +8,7 @@ applications:
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
source: *openstack-origin
osd-devices: '/dev/test-non-existent'

View File

@ -7,7 +7,7 @@ applications:
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
osd-devices: '/dev/test-non-existent'
source: *openstack-origin
@ -30,7 +30,7 @@ applications:
channel: latest/edge
vault-mysql-router:
charm: ch:mysql-router
channel: latest/edge
channel: 8.0/edge
ceph-dashboard:
charm: ../../ceph-dashboard.charm
options:

View File

@ -8,7 +8,7 @@ applications:
series: kinetic
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
source: *source
osd-devices: '/dev/test-non-existent'

View File

@ -8,11 +8,11 @@ applications:
series: lunar
num_units: 6
storage:
osd-devices: 'cinder,10G'
osd-devices: 'cinder,10G,2'
options:
source: *source
osd-devices: '/dev/test-non-existent'
channel: latest/edge
channel: quincy/edge
ceph-mon:
charm: ch:ceph-mon
series: lunar
@ -20,7 +20,7 @@ applications:
options:
source: *source
monitor-count: '3'
channel: latest/edge
channel: quincy/edge
vault:
num_units: 1
charm: ch:vault
@ -31,10 +31,10 @@ applications:
num_units: 3
options:
source: *source
channel: latest/edge
channel: 8.0/edge
vault-mysql-router:
charm: ch:mysql-router
channel: latest/edge
channel: 8.0/edge
ceph-dashboard:
charm: ../../ceph-dashboard.charm
options:
@ -63,14 +63,14 @@ applications:
num_units: 3
options:
source: *source
channel: latest/edge
channel: quincy/edge
ceph-fs:
charm: ch:ceph-fs
series: lunar
num_units: 1
options:
source: *source
channel: latest/edge
channel: quincy/edge
ceph-iscsi:
charm: ch:ceph-iscsi
series: lunar
@ -78,7 +78,7 @@ applications:
options:
source: *source
gateway-metadata-pool: iscsi-foo-metadata
channel: latest/edge
channel: quincy/edge
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'