Zap journal once
This commit is contained in:
parent
aeb923dc27
commit
d8704bdc92
|
@ -109,6 +109,11 @@ def rescan_osd_devices():
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
def zap_disk(dev):
|
||||||
|
cmd = ['sgdisk', '--zap-all', dev]
|
||||||
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
_bootstrap_keyring = "/var/lib/ceph/bootstrap-osd/ceph.keyring"
|
_bootstrap_keyring = "/var/lib/ceph/bootstrap-osd/ceph.keyring"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ def emit_cephconf():
|
||||||
with open('/etc/ceph/ceph.conf', 'w') as cephconf:
|
with open('/etc/ceph/ceph.conf', 'w') as cephconf:
|
||||||
cephconf.write(utils.render_template('ceph.conf', cephcontext))
|
cephconf.write(utils.render_template('ceph.conf', cephcontext))
|
||||||
|
|
||||||
|
JOURNAL_ZAPPED = '/var/lib/ceph/journal_zapped'
|
||||||
|
|
||||||
|
|
||||||
def config_changed():
|
def config_changed():
|
||||||
utils.juju_log('INFO', 'Begin config-changed hook.')
|
utils.juju_log('INFO', 'Begin config-changed hook.')
|
||||||
|
@ -69,6 +71,14 @@ def config_changed():
|
||||||
filesystem_mounted(e_mountpoint)):
|
filesystem_mounted(e_mountpoint)):
|
||||||
subprocess.call(['umount', e_mountpoint])
|
subprocess.call(['umount', e_mountpoint])
|
||||||
|
|
||||||
|
osd_journal = utils.config_get('osd-journal')
|
||||||
|
if (osd_journal and
|
||||||
|
not os.path.exists(JOURNAL_ZAPPED) and
|
||||||
|
os.path.exists(osd_journal)):
|
||||||
|
ceph.zap_disk(osd_journal)
|
||||||
|
with open(JOURNAL_ZAPPED, 'w') as zapped:
|
||||||
|
zapped.write('DONE')
|
||||||
|
|
||||||
for dev in utils.config_get('osd-devices').split(' '):
|
for dev in utils.config_get('osd-devices').split(' '):
|
||||||
osdize(dev)
|
osdize(dev)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue