Add feature to enabled forced reformatting of OSD devices.
This commit is contained in:
parent
ddce0cddcc
commit
440e60d6cc
@ -39,6 +39,15 @@ options:
|
|||||||
.
|
.
|
||||||
These devices are the range of devices that will be checked for and
|
These devices are the range of devices that will be checked for and
|
||||||
used across all service units.
|
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:
|
ephemeral-unmount:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
|
@ -121,6 +121,13 @@ def bootstrap_monitor_cluster():
|
|||||||
os.unlink(keyring)
|
os.unlink(keyring)
|
||||||
|
|
||||||
|
|
||||||
|
def reformat_osd():
|
||||||
|
if utils.config_get('osd-reformat') != "":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def osdize(dev):
|
def osdize(dev):
|
||||||
if not os.path.exists(dev):
|
if not os.path.exists(dev):
|
||||||
utils.juju_log('INFO',
|
utils.juju_log('INFO',
|
||||||
@ -131,7 +138,8 @@ def osdize(dev):
|
|||||||
if e_mountpoint != "":
|
if e_mountpoint != "":
|
||||||
subprocess.call(['umount', 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',
|
utils.juju_log('INFO',
|
||||||
'Looks like {} is already an OSD, skipping.'
|
'Looks like {} is already an OSD, skipping.'
|
||||||
.format(dev))
|
.format(dev))
|
||||||
|
Loading…
Reference in New Issue
Block a user