Charm Interface - Ceph Client
Go to file
Liam Young aec6677875 Support charm specifying weight on pool creation
When a charm requests a pool in cannot specify the weight atm as
the create_pool function forces it to None.

Change-Id: I40a85cf5c0e943aef0b4ec507d8c9b3a24ba09a8
2018-12-06 13:52:21 +00:00
.gitignore Add initial requires 2017-07-03 15:17:35 +01:00
.gitreview Add support for ceph-proxy dataset 2017-09-26 08:07:11 +01:00
.project Add initial requires 2017-07-03 15:17:35 +01:00
.pydevproject Add initial requires 2017-07-03 15:17:35 +01:00
.zuul.yaml import zuul job settings from project-config 2018-10-04 12:02:22 +02:00
README.md Add initial requires 2017-07-03 15:17:35 +01:00
interface.yaml initial ceph-client commit 2016-05-24 14:30:49 -04:00
provides.py do not need empty key 2016-05-26 16:43:12 -04:00
requires.py Support charm specifying weight on pool creation 2018-12-06 13:52:21 +00:00
test-requirements.txt Add initial requires 2017-07-03 15:17:35 +01:00
tox.ini fix tox python3 overrides 2018-10-04 12:35:37 +00:00

README.md

Overview

This interface layer handles the communication between the Ceph Monitor cluster and a client that requires an access key and a pool to use.

Usage

Requires

This interface layer will set the following states, as appropriate:

  • {relation_name}.available The ceph client has been related to a provider.

The following accessors will be available:

  • key - The cephx access key
  • auth - Whether or not strict auth is supported
  • mon_hosts - The public addresses list of the monitor cluster

Client example:

@when('ceph-client.connected')
def ceph_connected(ceph_client):
  ceph_client.create_pool('newpool')

@when('ceph-client.available')
def ceph_ready(ceph_client):
  charm_ceph_conf= os.path.join(os.sep, 'etc', 'ceph', 'ceph.conf')
  cephx_key = os.path.join(os.sep, 'etc', 'ceph', 'ceph.client.charm.keyring')

  ceph_context = {
      'auth_supported': ceph_client.auth,
      'mon_hosts': ceph_client.mon_hosts,
  }

  with open(charm_ceph_conf, 'w') as cephconf:
    cephconf.write(render_template('ceph.conf', ceph_context))

  # Write out the cephx_key also
  with open(cephx_key, 'w') as cephconf:
    cephconf.write(ceph_client.key)