From 75077816be4783573d6809447ff2cde8c427d502 Mon Sep 17 00:00:00 2001 From: James Page Date: Tue, 18 Dec 2012 10:25:38 +0000 Subject: [PATCH] Add support for BTRFS --- config.yaml | 1 + hooks/ceph.py | 6 ++++++ hooks/hooks.py | 14 ++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/config.yaml b/config.yaml index baa947c..7b2f56d 100644 --- a/config.yaml +++ b/config.yaml @@ -54,6 +54,7 @@ options: . xfs (Default >= 0.55) ext4 (Only option < 0.55) + btrfs (experimental and not recommended) . Only supported with ceph >= 0.55. osd-reformat: diff --git a/hooks/ceph.py b/hooks/ceph.py index b3b67f4..6502b18 100644 --- a/hooks/ceph.py +++ b/hooks/ceph.py @@ -85,6 +85,12 @@ def add_bootstrap_hint(peer): # Ignore any errors for this call subprocess.call(cmd) +DISK_FORMATS = [ + 'xfs', + 'ext4', + 'btrfs' + ] + def is_osd_disk(dev): try: diff --git a/hooks/hooks.py b/hooks/hooks.py index ec1453b..a760987 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -29,7 +29,7 @@ def install_upstart_scripts(): def install(): utils.juju_log('INFO', 'Begin install hook.') utils.configure_source() - utils.install('ceph', 'gdisk', 'ntp') + utils.install('ceph', 'gdisk', 'ntp', 'btrfs-tools') install_upstart_scripts() utils.juju_log('INFO', 'End install hook.') @@ -53,16 +53,18 @@ def config_changed(): utils.juju_log('INFO', 'Monitor hosts are ' + repr(get_mon_hosts())) - fsid = utils.config_get('fsid') - if fsid == '': + # Pre-flight checks + if not utils.config_get('fsid'): utils.juju_log('CRITICAL', 'No fsid supplied, cannot proceed.') sys.exit(1) - - monitor_secret = utils.config_get('monitor-secret') - if not monitor_secret: + if not utils.config_get('monitor-secret'): utils.juju_log('CRITICAL', 'No monitor-secret supplied, cannot proceed.') sys.exit(1) + if utils.config_get('osd-format') not in ceph.DISK_FORMATS: + utils.juju_log('CRITICAL', + 'Invalid OSD disk format configuration specified') + sys.exit(1) emit_cephconf()