Skip to content

Commit

Permalink
Merge pull request #295 from gbregman/devel
Browse files Browse the repository at this point in the history
Display the actual Ceph version in the NVMEof log
  • Loading branch information
gbregman authored Oct 29, 2023
2 parents e1c4c57 + 8a3e650 commit a673152
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions control/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,23 @@ def __exit__(self, exc_type, exc_value, traceback):
self.watch.close()
self.ioctx.close()

def fetch_and_display_ceph_version(self, conn):
try:
rply = conn.mon_command('{"prefix":"mon versions"}', b'')
ceph_ver = rply[1].decode().removeprefix("{").strip().split(":")[0].removeprefix('"').removesuffix('"')
ceph_ver = ceph_ver.removeprefix("ceph version ")
self.logger.info(f"Connected to Ceph with version \"{ceph_ver}\"")
except Exception as ex:
self.logger.debug(f"Got exception trying to fetch Ceph version: {ex}")
pass

def open_rados_connection(self, config):
ceph_pool = config.get("ceph", "pool")
ceph_conf = config.get("ceph", "config_file")
rados_id = config.get_with_default("ceph", "id", "")
conn = rados.Rados(conffile=ceph_conf, rados_id=rados_id)
conn.connect()
self.fetch_and_display_ceph_version(conn)
ioctx = conn.open_ioctx(ceph_pool)
return ioctx

Expand Down

0 comments on commit a673152

Please sign in to comment.