Skip to content
Snippets Groups Projects
Commit 87723263 authored by Chris MacNaughton's avatar Chris MacNaughton
Browse files

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: Ic4410a94171b1d77f2a7c2bc56ed4c0dabb2b2d8
parent 3a3cbcb3
No related branches found
No related tags found
No related merge requests found
......@@ -179,6 +179,11 @@ options:
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
max-sectors-kb:
default: 1048576
type: int
......
......@@ -190,9 +190,16 @@ def install():
def az_info():
az_info = os.environ.get('JUJU_AVAILABILITY_ZONE')
log("AZ Info: " + az_info)
return 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():
......@@ -248,9 +255,10 @@ def get_ceph_context():
cephcontext['cluster_addr'] = get_cluster_addr()
if config('customize-failure-domain'):
if az_info():
cephcontext['crush_location'] = "root=default rack={} host={}" \
.format(az_info(), socket.gethostname())
az = az_info()
if az:
cephcontext['crush_location'] = "root=default {} host={}" \
.format(az, socket.gethostname())
else:
log(
"Your Juju environment doesn't"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment