Unit check and test colocation with osds
This commit is contained in:
parent
5e4817b380
commit
2edf2607d0
11
src/charm.py
11
src/charm.py
@ -14,6 +14,7 @@ from ops.framework import (
|
||||
StoredState,
|
||||
)
|
||||
from ops.main import main
|
||||
import ops.model
|
||||
import charmhelpers.core.host as ch_host
|
||||
import charmhelpers.core.templating as ch_templating
|
||||
import interface_ceph_client
|
||||
@ -98,6 +99,9 @@ class CephISCSIGatewayCharmBase(ops_openstack.OSBaseCharm):
|
||||
|
||||
DEFAULT_TARGET = "iqn.2003-01.com.ubuntu.iscsi-gw:iscsi-igw"
|
||||
REQUIRED_RELATIONS = ['ceph-client', 'cluster']
|
||||
# Two has been tested before is probably fine too but needs
|
||||
# validating
|
||||
ALLOWED_UNIT_COUNTS = [2]
|
||||
|
||||
def __init__(self, framework, key):
|
||||
super().__init__(framework, key)
|
||||
@ -287,6 +291,13 @@ class CephISCSIGatewayCharmBase(ops_openstack.OSBaseCharm):
|
||||
self.state.enable_tls = True
|
||||
self.on_pools_available(event)
|
||||
|
||||
def custom_status_check(self):
|
||||
if self.peers.unit_count not in self.ALLOWED_UNIT_COUNTS:
|
||||
self.unit.status = ops.model.BlockedStatus(
|
||||
'{} is an invalid unit count'.format(self.peers.unit_count))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@ops_openstack.charm_class
|
||||
class CephISCSIGatewayCharmJewel(CephISCSIGatewayCharmBase):
|
||||
|
@ -100,3 +100,12 @@ class CephISCSIGatewayPeers(Object):
|
||||
for u in self.peer_rel.units:
|
||||
addresses.append(self.peer_rel.data[u]['ingress-address'])
|
||||
return sorted(addresses)
|
||||
|
||||
@property
|
||||
def peer_count(self):
|
||||
return len(self.peer_rel.units)
|
||||
|
||||
@property
|
||||
def unit_count(self):
|
||||
return len(self.peer_rel.units) + 1
|
||||
|
||||
|
@ -1,14 +1,31 @@
|
||||
series: bionic
|
||||
series: focal
|
||||
machines:
|
||||
'0':
|
||||
constraints: mem=3072M
|
||||
'1':
|
||||
'2':
|
||||
'3':
|
||||
'4':
|
||||
'5':
|
||||
'6':
|
||||
series: bionic
|
||||
'7':
|
||||
series: bionic
|
||||
'8':
|
||||
applications:
|
||||
ubuntu:
|
||||
charm: cs:ubuntu
|
||||
num_units: 1
|
||||
to:
|
||||
- '8'
|
||||
ceph-iscsi:
|
||||
charm: ../../
|
||||
series: focal
|
||||
num_units: 2
|
||||
options:
|
||||
rbd-metadata-pool: tmbtil
|
||||
to:
|
||||
- '0'
|
||||
- '1'
|
||||
ceph-osd:
|
||||
charm: cs:~gnuoy/ceph-osd-5
|
||||
num_units: 3
|
||||
@ -16,23 +33,35 @@ applications:
|
||||
osd-devices: 'cinder,10G'
|
||||
options:
|
||||
osd-devices: '/dev/test-non-existent'
|
||||
source: cloud:bionic-train
|
||||
to:
|
||||
- '0'
|
||||
- '1'
|
||||
- '2'
|
||||
ceph-mon:
|
||||
charm: cs:~gnuoy/ceph-mon-6
|
||||
num_units: 3
|
||||
options:
|
||||
monitor-count: '3'
|
||||
source: cloud:bionic-train
|
||||
to:
|
||||
- '3'
|
||||
- '4'
|
||||
- '5'
|
||||
vault:
|
||||
series: bionic
|
||||
num_units: 1
|
||||
# charm: cs:~openstack-charmers-next/vault
|
||||
charm: cs:~gnuoy/vault-29
|
||||
to:
|
||||
- '6'
|
||||
mysql:
|
||||
series: bionic
|
||||
charm: cs:~openstack-charmers-next/percona-cluster
|
||||
num_units: 1
|
||||
options:
|
||||
innodb-buffer-pool-size: 256M
|
||||
max-connections: 1000
|
||||
to:
|
||||
- '7'
|
||||
relations:
|
||||
- - ceph-mon:client
|
||||
- ceph-iscsi:ceph-client
|
||||
|
Loading…
Reference in New Issue
Block a user