This is used to retrieve a list of osd ids from the currently
running ceph-osd systemd units.
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit
15d20e29a2f2d74caf05dfec559e30941c7a46ab)
)
return rc == 0
+def get_running_osd_ids():
+ out, err, rc = process.call([
+ 'systemctl',
+ 'show',
+ '--no-pager',
+ '--property=Id',
+ '--state=running',
+ 'ceph-osd@*',
+ ])
+ osd_ids = []
+ for line in out:
+ if line:
+ # example line looks like: Id=ceph-osd@1.service
+ osd_id = line.split("@")[1].split(".service")[0]
+ osd_ids.append(osd_id)
+ return osd_ids
def start_osd(id_):
return start(osd_unit % id_)