General tidy of filesystem handling and ephemeral mount stealing.

This commit is contained in:
James Page 2012-11-12 10:00:27 +00:00
parent 440e60d6cc
commit 92506eac82
2 changed files with 15 additions and 6 deletions

View File

@ -60,6 +60,11 @@ def config_changed():
emit_cephconf()
e_mountpoint = utils.config_get('ephemeral-unmount')
if (e_mountpoint != "" and
filesystem_mounted(e_mountpoint)):
subprocess.call(['umount', e_mountpoint])
for dev in utils.config_get('osd-devices').split(' '):
osdize(dev)
@ -134,10 +139,6 @@ def osdize(dev):
'Path {} does not exist - bailing'.format(dev))
return
e_mountpoint = utils.config_get('ephemeral-unmount')
if e_mountpoint != "":
subprocess.call(['umount', e_mountpoint])
if (ceph.is_osd_disk(dev) and not
reformat_osd()):
utils.juju_log('INFO',
@ -145,7 +146,7 @@ def osdize(dev):
.format(dev))
return
if subprocess.call(['grep', '-wqs', dev + '1', '/proc/mounts']) == 0:
if device_mounted(dev):
utils.juju_log('INFO',
'Looks like {} is in use, skipping.'.format(dev))
return
@ -153,6 +154,14 @@ def osdize(dev):
subprocess.call(['ceph-disk-prepare', dev])
def device_mounted(dev):
return subprocess.call(['grep', '-wqs', dev + '1', '/proc/mounts']) == 0
def filesystem_mounted(fs):
return subprocess.call(['grep', '-wqs', fs, '/proc/mounts']) == 0
def mon_relation():
utils.juju_log('INFO', 'Begin mon-relation hook.')
emit_cephconf()

View File

@ -1 +1 @@
87
88