Add feature to enable forced reformatting of OSD devices.
This commit is contained in:
parent
e30f3f7b3c
commit
547ba59e7a
@ -7,6 +7,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: |
|
||||
|
@ -89,6 +89,13 @@ def get_conf(name):
|
||||
return None
|
||||
|
||||
|
||||
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',
|
||||
@ -99,7 +106,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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user