Helpers for writing Ceph OpenStack Charms
Go to file
Samuel Walladge 07671ae83d Fix crash in extracting local osd ids
The function `get_local_osd_ids` crashes when the /var/lib/ceph/osd/
directory contains a file whose name doesn't contain a `-`.

unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed Traceback (most recent call last):
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed   File "/var/lib/juju/agents/unit-ceph-osd-0/charm/hooks/mon-relation-changed", line 904, in <module>
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed     hooks.execute(sys.argv)
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed   File "/var/lib/juju/agents/unit-ceph-osd-0/charm/hooks/charmhelpers/core/hookenv.py", line 963, in execute
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed     self._hooks[hook_name]()
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed   File "/var/lib/juju/agents/unit-ceph-osd-0/charm/hooks/mon-relation-changed", line 668, in mon_relation
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed     ceph.apply_osd_settings(settings)
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed   File "/var/lib/juju/agents/unit-ceph-osd-0/charm/lib/charms_ceph/utils.py", line 3420, in apply_osd_settings
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed     for osd_id in get_local_osd_ids():
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed   File "/var/lib/juju/agents/unit-ceph-osd-0/charm/lib/charms_ceph/utils.py", line 698, in get_local_osd_ids
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed     osd_id = osd_dir.split('-')[1]
unit-ceph-osd-0: 03:34:14 WARNING unit.ceph-osd/0.mon-relation-changed IndexError: list index out of range

Fix the issue by setting a fallback in this case.

Change-Id: I0fec65c9b88e6484905a76140d0921cf3dd843c0
2023-01-06 12:22:22 +10:30
charms_ceph Fix crash in extracting local osd ids 2023-01-06 12:22:22 +10:30
unit_tests Fix crash in extracting local osd ids 2023-01-06 12:22:22 +10:30
.gitignore Add optional additional device types 2017-09-25 11:30:36 -04:00
.gitreview OpenDev Migration Patch 2019-04-19 19:39:40 +00:00
.stestr.conf Add helper for creating rbd-mirror key 2019-02-13 07:08:22 +01:00
.zuul.yaml bump CI jobs to Yoga 2022-09-28 16:22:07 -04:00
README.md Show team and repo badges on README 2016-11-25 19:27:34 +01:00
requirements.txt Move nose to test-requirements.txt 2016-11-15 10:03:01 -05:00
setup.py Properly account for charms.ceph dependencies 2022-08-24 20:19:33 +00:00
test-requirements.txt Use common pool create/update handling code 2020-08-26 15:27:03 +02:00
tox.ini Fixed raise text value instead of Exception 2021-03-31 21:26:21 +02:00

README.md

Team and repository tags

Team and repository tags

charms_ceph

Helper functions for the ceph charms. This library has shared functionality that is used in the ceph-mon, ceph-osd and ceph charms. Anything that needs to be shared across the ceph charms should live here.