Import Existing Clusters

Adding a config.yaml variable to allow existing ceph
monitor clusters to be imported. This patch will use
the config variable first and the get_mon_hosts function
second in order to determine which mons are in the cluster.

Change-Id: Ia06c509edb18615a9582f0184b03196a04ce9a0f
This commit is contained in:
Chris Holcombe 2017-03-06 13:59:50 -08:00
parent 9078f8eb5f
commit 03cf585d2f
4 changed files with 12 additions and 2 deletions

View File

@ -114,6 +114,8 @@ Please refer to the [Ceph Network Reference](http://docs.ceph.com/docs/master/ra
**NOTE**: Existing deployments using ceph-*-network configuration options will continue to function; these options are preferred over any network space binding provided if set.
**NOTE**: The mon-hosts field is only used to migrate existing clusters to a juju managed solution and should be left blank otherwise.
# Contact Information
## Authors

View File

@ -56,6 +56,13 @@ options:
How many nodes to wait for before trying to create the monitor cluster
this number needs to be odd, and more than three is a waste except for
very large clusters.
mon-hosts:
type: string
default:
description: |
A comma separated list of ceph mon hosts to use. This field is only
used to migrate an existing cluster to a juju managed solution
and should be left blank otherwise.
expected-osd-count:
type: int
default: 0

View File

@ -137,7 +137,7 @@ def get_ceph_context():
cephcontext = {
'auth_supported': config('auth-supported'),
'mon_hosts': ' '.join(get_mon_hosts()),
'mon_hosts': config('mon-hosts') or ' '.join(get_mon_hosts()),
'fsid': leader_get('fsid'),
'old_auth': cmp_pkgrevno('ceph', "0.51") < 0,
'use_syslog': str(config('use-syslog')).lower(),
@ -468,7 +468,7 @@ def admin_relation_joined(relid=None):
data = {'key': ceph.get_named_key(name=name, caps=ceph.admin_caps),
'fsid': leader_get('fsid'),
'auth': config('auth-supported'),
'mon_hosts': " ".join(get_mon_hosts())
'mon_hosts': config('mon-hosts') or " ".join(get_mon_hosts())
}
relation_set(relation_id=relid,
relation_settings=data)

View File

@ -22,6 +22,7 @@ CHARM_CONFIG = {'config-flags': '',
'osd-journal-size': 1024,
'use-direct-io': True,
'osd-format': 'ext4',
'mon-hosts': '',
'prefer-ipv6': False}