Add availability_zone to the OSD configuration
Addition of configurable availability_zone allows the administrator to deploy Ceph with two dimensions of crush locations, one from config and one from Juju's availability zone Change-Id: Icd0ee2eeaea8bad2b78f2ed46176084e01601261
This commit is contained in:
parent
780c3b3d95
commit
a52acb9760
13
config.yaml
13
config.yaml
|
@ -191,10 +191,21 @@ options:
|
||||||
kernel.threads-max: 2097152 }'
|
kernel.threads-max: 2097152 }'
|
||||||
description: |
|
description: |
|
||||||
YAML-formatted associative array of sysctl key/value pairs to be set
|
YAML-formatted associative array of sysctl key/value pairs to be set
|
||||||
persistently. By default we set pid_max, max_map_count and
|
persistently. By default we set pid_max, max_map_count and
|
||||||
threads-max to a high value to avoid problems with large numbers (>20)
|
threads-max to a high value to avoid problems with large numbers (>20)
|
||||||
of OSDs recovering. very large clusters should set those values even
|
of OSDs recovering. very large clusters should set those values even
|
||||||
higher (e.g. max for kernel.pid_max is 4194303).
|
higher (e.g. max for kernel.pid_max is 4194303).
|
||||||
|
customize-failure-domain:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
description: |
|
||||||
|
Setting this to true will tell Ceph to replicate across Juju's
|
||||||
|
Availability Zone instead of specifically by host.
|
||||||
|
availability_zone:
|
||||||
|
type: string
|
||||||
|
default:
|
||||||
|
description: |
|
||||||
|
Custom availablility zone to provide to Ceph for the OSD placement
|
||||||
nagios_context:
|
nagios_context:
|
||||||
type: string
|
type: string
|
||||||
default: "juju"
|
default: "juju"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import socket
|
||||||
|
|
||||||
sys.path.append('lib')
|
sys.path.append('lib')
|
||||||
import ceph
|
import ceph
|
||||||
|
@ -150,6 +151,19 @@ def install():
|
||||||
apt_install(packages=ceph.PACKAGES, fatal=True)
|
apt_install(packages=ceph.PACKAGES, fatal=True)
|
||||||
|
|
||||||
|
|
||||||
|
def az_info():
|
||||||
|
az_info = ""
|
||||||
|
juju_az_info = os.environ.get('JUJU_AVAILABILITY_ZONE')
|
||||||
|
if juju_az_info:
|
||||||
|
az_info = "{} juju_availability_zone={}".format(az_info, juju_az_info)
|
||||||
|
config_az = config("availability_zone")
|
||||||
|
if config_az:
|
||||||
|
az_info = "{} config_availability_zone={}".format(az_info, config_az)
|
||||||
|
if az_info != "":
|
||||||
|
log("AZ Info: " + az_info)
|
||||||
|
return az_info
|
||||||
|
|
||||||
|
|
||||||
def use_short_objects():
|
def use_short_objects():
|
||||||
'''
|
'''
|
||||||
Determine whether OSD's should be configured with
|
Determine whether OSD's should be configured with
|
||||||
|
@ -199,6 +213,17 @@ def get_ceph_context():
|
||||||
cephcontext['public_addr'] = get_public_addr()
|
cephcontext['public_addr'] = get_public_addr()
|
||||||
cephcontext['cluster_addr'] = get_cluster_addr()
|
cephcontext['cluster_addr'] = get_cluster_addr()
|
||||||
|
|
||||||
|
if config('customize-failure-domain'):
|
||||||
|
az = az_info()
|
||||||
|
if az:
|
||||||
|
cephcontext['crush_location'] = "root=default {} host={}" \
|
||||||
|
.format(az, socket.gethostname())
|
||||||
|
else:
|
||||||
|
log(
|
||||||
|
"Your Juju environment doesn't"
|
||||||
|
"have support for Availability Zones"
|
||||||
|
)
|
||||||
|
|
||||||
# NOTE(dosaboy): these sections must correspond to what is supported in the
|
# NOTE(dosaboy): these sections must correspond to what is supported in the
|
||||||
# config template.
|
# config template.
|
||||||
sections = ['global', 'mds', 'osd', 'mon']
|
sections = ['global', 'mds', 'osd', 'mon']
|
||||||
|
|
|
@ -29,7 +29,8 @@ CHARM_CONFIG = {'config-flags': '',
|
||||||
'osd-journal-size': 1024,
|
'osd-journal-size': 1024,
|
||||||
'use-direct-io': True,
|
'use-direct-io': True,
|
||||||
'osd-format': 'ext4',
|
'osd-format': 'ext4',
|
||||||
'prefer-ipv6': False}
|
'prefer-ipv6': False,
|
||||||
|
'customize-failure-domain': False}
|
||||||
|
|
||||||
|
|
||||||
class CephHooksTestCase(unittest.TestCase):
|
class CephHooksTestCase(unittest.TestCase):
|
||||||
|
|
Loading…
Reference in New Issue