Use `ceph-rbd-mirror` interface, move boilerplate upstream
Make use of newly created `ceph` layer and `CephCharm` class added to `charms.openstack`.
This commit is contained in:
parent
5537237ea7
commit
ededdceecc
|
@ -1,23 +1 @@
|
|||
options:
|
||||
source:
|
||||
default: distro
|
||||
type: string
|
||||
description: |
|
||||
Repository from which to install Ceph
|
||||
|
||||
May be one of the following:
|
||||
|
||||
distro (default)
|
||||
ppa:somecustom/ppa (PPA name must include UCA OpenStack Release name)
|
||||
deb url sources entry|key id
|
||||
or a supported Ubuntu Cloud Archive pocket.
|
||||
|
||||
Supported Ubuntu Cloud Archive pockets include:
|
||||
|
||||
cloud:xenial-pike
|
||||
cloud:xenial-queens
|
||||
cloud:bionic-rocky
|
||||
|
||||
Note that updating this setting to a source that is known to
|
||||
provide a later version of Ceph will trigger a software
|
||||
upgrade.
|
||||
options: {}
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
includes:
|
||||
- layer:leadership
|
||||
- layer:openstack
|
||||
- interface:ceph-client
|
||||
- layer:ceph
|
||||
- interface:ceph-rbd-mirror
|
||||
- interface:nrpe-external-master
|
||||
options:
|
||||
basic:
|
||||
use_venv: True
|
||||
include_system_packages: True
|
||||
repo: https://github.com/openstack/charm-ceph-rbd-mirror
|
||||
config:
|
||||
deletes:
|
||||
- debug
|
||||
- verbose
|
||||
- use-internal-endpoints
|
||||
- ssl_ca
|
||||
|
|
|
@ -12,30 +12,22 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
|
||||
import charms_openstack.charm
|
||||
import charms_openstack.adapters
|
||||
|
||||
|
||||
class CephRBDMirrorCharm(charms_openstack.charm.OpenStackCharm):
|
||||
# Override source config key to be compatible with the other Ceph charms
|
||||
source_config_key = 'source'
|
||||
|
||||
class CephRBDMirrorCharm(charms_openstack.charm.CephCharm):
|
||||
# We require Ceph 12.2 Luminous or later for HA support in the Ceph
|
||||
# rbd-mirror daemon. Luminous appears in UCA at pike.
|
||||
release = 'pike'
|
||||
name = 'ceph-rbd-mirror'
|
||||
packages = ['rbd-mirror']
|
||||
python_version = 3
|
||||
required_relations = ['ceph-cluster']
|
||||
release_pkg = 'rbd-mirror'
|
||||
package_codenames = {
|
||||
'rbd-mirror': collections.OrderedDict([
|
||||
('12', 'pike'),
|
||||
('13', 'rocky'),
|
||||
]),
|
||||
}
|
||||
required_relations = ['ceph-local', 'ceph-remote']
|
||||
|
||||
def config_changed(self):
|
||||
"""Check for upgrade."""
|
||||
self.upgrade_if_available(None)
|
||||
|
||||
def install(self):
|
||||
"""We override install function to configure source before installing
|
||||
|
|
|
@ -28,5 +28,7 @@ provides:
|
|||
interface: nrpe-external-master
|
||||
scope: container
|
||||
requires:
|
||||
ceph-cluster:
|
||||
interface: ceph-client
|
||||
ceph-local:
|
||||
interface: ceph-rbd-mirror
|
||||
ceph-remote:
|
||||
interface: ceph-rbd-mirror
|
||||
|
|
|
@ -26,12 +26,38 @@ charms_openstack.bus.discover()
|
|||
charm.use_defaults(
|
||||
'charm.installed',
|
||||
'config.changed',
|
||||
'update-status')
|
||||
'update-status',
|
||||
'upgrade-charm')
|
||||
|
||||
|
||||
@reactive.when('ceph-cluster.connected')
|
||||
@reactive.when_all('ceph-local.connected', 'ceph-remote.connected')
|
||||
@reactive.when_not_all('ceph-local.available', 'ceph-remote.available')
|
||||
def ceph_connected():
|
||||
for flag in ('ceph-local.connected', 'ceph-remote.connected'):
|
||||
endpoint = reactive.relations.endpoint_from_flag(flag)
|
||||
endpoint.request_key()
|
||||
|
||||
with charm.provide_charm_instance() as charm_instance:
|
||||
ch_core.hookenv.log('Ceph connected, charm_instance @ {}'
|
||||
.format(charm_instance),
|
||||
level=ch_core.hookenv.DEBUG)
|
||||
charm_instance.assess_status()
|
||||
|
||||
|
||||
@reactive.when_all('ceph-local.available', 'ceph-remote.available')
|
||||
def ceph_available():
|
||||
mon_hosts = {}
|
||||
for flag in ('ceph-local.available', 'ceph-remote.available'):
|
||||
endpoint = reactive.relations.endpoint_from_flag(flag)
|
||||
mon_hosts[endpoint.endpoint_name] = endpoint.mon_hosts
|
||||
for relation in endpoint.relations:
|
||||
for unit in relation.units:
|
||||
ch_core.hookenv.log('{}: "{}"'.format(flag, unit.received),
|
||||
level=ch_core.hookenv.INFO)
|
||||
|
||||
with charm.provide_charm_instance() as charm_instance:
|
||||
ch_core.hookenv.log('Ceph available, mon_hosts: "{}" '
|
||||
'charm_instance @ {}'
|
||||
.format(mon_hosts, charm_instance),
|
||||
level=ch_core.hookenv.DEBUG)
|
||||
charm_instance.assess_status()
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
series: bionic
|
||||
applications:
|
||||
ceph-mon:
|
||||
charm: cs:~fnordahl/ceph-mon-rbd-mirror
|
||||
num_units: 3
|
||||
options:
|
||||
expected-osd-count: 3
|
||||
source: distro
|
||||
ceph-osd:
|
||||
charm: cs:~openstack-charmers-next/ceph-osd
|
||||
num_units: 3
|
||||
options:
|
||||
source: distro
|
||||
storage:
|
||||
osd-devices: cinder,20G
|
||||
ceph-rbd-mirror:
|
||||
series: bionic
|
||||
charm: ../../../ceph-rbd-mirror
|
||||
num_units: 1
|
||||
options:
|
||||
source: distro
|
||||
ceph-mon-b:
|
||||
charm: cs:~fnordahl/ceph-mon-rbd-mirror
|
||||
num_units: 3
|
||||
options:
|
||||
expected-osd-count: 3
|
||||
source: distro
|
||||
ceph-osd-b:
|
||||
charm: cs:~openstack-charmers-next/ceph-osd
|
||||
num_units: 3
|
||||
options:
|
||||
source: distro
|
||||
storage:
|
||||
osd-devices: cinder,20G
|
||||
ceph-rbd-mirror-b:
|
||||
series: bionic
|
||||
charm: ../../../ceph-rbd-mirror
|
||||
num_units: 1
|
||||
options:
|
||||
source: distro
|
||||
relations:
|
||||
- - ceph-mon:osd
|
||||
- ceph-osd:mon
|
||||
- - ceph-mon
|
||||
- ceph-rbd-mirror:ceph-local
|
||||
- - ceph-mon
|
||||
- ceph-rbd-mirror-b:ceph-remote
|
||||
- - ceph-mon-b:osd
|
||||
- ceph-osd-b:mon
|
||||
- - ceph-mon-b
|
||||
- ceph-rbd-mirror-b:ceph-local
|
||||
- - ceph-mon-b
|
||||
- ceph-rbd-mirror:ceph-remote
|
|
@ -0,0 +1,15 @@
|
|||
charm_name: ceph-rbd-mirror
|
||||
smoke_bundles:
|
||||
- bionic-queens
|
||||
gate_bundles:
|
||||
- xenial-pike
|
||||
- xenial-queens
|
||||
- bionic-queens
|
||||
- bionic-rocky
|
||||
- cosmic-rocky
|
||||
dev_bundles:
|
||||
- disco-stein
|
||||
configure:
|
||||
- zaza.charm_tests.noop.setup.basic_setup
|
||||
tests:
|
||||
- zaza.charm_tests.noop.tests.NoopTest
|
Loading…
Reference in New Issue