Ensure we populate osd-devices with existing devices
If an older version of ceph-osd is deployed and then upgraded to a version that keeps track of bootstrapped OSDs, then the list of osd-devices never gets updated with the pre-existing devices. This change allows us to add existing, mounted Ceph OSDs to the osd-devices entry in the local KV storage. Change-Id: I17fab658511275f1dde15683ef296d4c72e7980e Closes-Bug: #1814597 Depends-On: I940b108d914b39b55013a4617c3d17ff7122df60
This commit is contained in:
parent
faefe90ce6
commit
9bc5abab55
|
@ -1442,6 +1442,7 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
|
||||||
|
|
||||||
db = kv()
|
db = kv()
|
||||||
osd_devices = db.get('osd-devices', [])
|
osd_devices = db.get('osd-devices', [])
|
||||||
|
try:
|
||||||
if dev in osd_devices:
|
if dev in osd_devices:
|
||||||
log('Device {} already processed by charm,'
|
log('Device {} already processed by charm,'
|
||||||
' skipping'.format(dev))
|
' skipping'.format(dev))
|
||||||
|
@ -1458,6 +1459,8 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
|
||||||
if is_osd_disk(dev):
|
if is_osd_disk(dev):
|
||||||
log('Looks like {} is already an'
|
log('Looks like {} is already an'
|
||||||
' OSD data or journal, skipping.'.format(dev))
|
' OSD data or journal, skipping.'.format(dev))
|
||||||
|
if is_device_mounted(dev):
|
||||||
|
osd_devices.append(dev)
|
||||||
return
|
return
|
||||||
|
|
||||||
if is_device_mounted(dev):
|
if is_device_mounted(dev):
|
||||||
|
@ -1467,6 +1470,7 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
|
||||||
if is_active_bluestore_device(dev):
|
if is_active_bluestore_device(dev):
|
||||||
log('{} is in use as an active bluestore block device,'
|
log('{} is in use as an active bluestore block device,'
|
||||||
' skipping.'.format(dev))
|
' skipping.'.format(dev))
|
||||||
|
osd_devices.append(dev)
|
||||||
return
|
return
|
||||||
|
|
||||||
if is_mapped_luks_device(dev):
|
if is_mapped_luks_device(dev):
|
||||||
|
@ -1511,6 +1515,7 @@ def osdize_dev(dev, osd_format, osd_journal, ignore_errors=False,
|
||||||
# the charm only tries to initialize a device of OSD usage
|
# the charm only tries to initialize a device of OSD usage
|
||||||
# once during its lifetime.
|
# once during its lifetime.
|
||||||
osd_devices.append(dev)
|
osd_devices.append(dev)
|
||||||
|
finally:
|
||||||
db.set('osd-devices', osd_devices)
|
db.set('osd-devices', osd_devices)
|
||||||
db.flush()
|
db.flush()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue