be more careful when intializing disks by checking for the ceph UUID in the GPT
This commit is contained in:
parent
bb478f29b8
commit
bcaa44a719
|
@ -57,3 +57,15 @@ def add_bootstrap_hint(peer):
|
|||
if os.path.exists(asok):
|
||||
# Ignore any errors for this call
|
||||
subprocess.call(cmd)
|
||||
|
||||
|
||||
def is_osd_disk(dev):
|
||||
try:
|
||||
info = subprocess.check_output(['sgdisk', '-i', '1', dev])
|
||||
info = info.split("\n")
|
||||
for line in info:
|
||||
if line.startswith('Partition GUID code: 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D'):
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
return False
|
||||
|
|
|
@ -133,12 +133,18 @@ def osdize(dev):
|
|||
# XXX hack for instances
|
||||
subprocess.call(['umount', '/mnt'])
|
||||
|
||||
if ceph.is_osd_disk(dev):
|
||||
utils.juju_log('INFO',
|
||||
'Looks like {} is already an OSD, skipping.'.format(dev))
|
||||
return
|
||||
|
||||
if subprocess.call(['grep', '-wqs', dev + '1', '/proc/mounts']) == 0:
|
||||
utils.juju_log('INFO',
|
||||
'Looks like {} is in use, skipping.'.format(dev))
|
||||
else:
|
||||
if os.path.exists(dev):
|
||||
subprocess.call(['ceph-disk-prepare', dev])
|
||||
return
|
||||
|
||||
if os.path.exists(dev):
|
||||
subprocess.call(['ceph-disk-prepare', dev])
|
||||
|
||||
|
||||
def mon_relation():
|
||||
|
|
Loading…
Reference in New Issue