Add feature to enabled forced reformatting of OSD devices.

This commit is contained in:
James Page 2012-11-12 09:45:28 +00:00
parent ddce0cddcc
commit 440e60d6cc
3 changed files with 19 additions and 2 deletions

View File

@ -39,6 +39,15 @@ options:
.
These devices are the range of devices that will be checked for and
used across all service units.
osd-reformat:
type: string
description: |
By default, the charm will not re-format a device that already looks
as if it might be an OSD device. This is a safeguard to try to
prevent data loss.
.
Specifying this option (any value) forces a reformat of any OSD devices
found which are not already mounted.
ephemeral-unmount:
type: string
description: |

View File

@ -121,6 +121,13 @@ def bootstrap_monitor_cluster():
os.unlink(keyring)
def reformat_osd():
if utils.config_get('osd-reformat') != "":
return True
else:
return False
def osdize(dev):
if not os.path.exists(dev):
utils.juju_log('INFO',
@ -131,7 +138,8 @@ def osdize(dev):
if e_mountpoint != "":
subprocess.call(['umount', e_mountpoint])
if ceph.is_osd_disk(dev):
if (ceph.is_osd_disk(dev) and not
reformat_osd()):
utils.juju_log('INFO',
'Looks like {} is already an OSD, skipping.'
.format(dev))

View File

@ -1 +1 @@
86
87