Skip to content

Commit

Permalink
common: Add metadata with only Ceph version number and release
Browse files Browse the repository at this point in the history
This prevents consumers from this data to have to fully parse
and split the 'ceph_version' string which is prone to errors.

ceph_version_short only contains the version number (maj, min, patch)
and ceph_release the codename, eg, luminous.

Signed-off-by: Wido den Hollander <[email protected]>
  • Loading branch information
wido committed Mar 28, 2018
1 parent dd03c5e commit 2a745f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ void collect_sys_info(map<string, string> *m, CephContext *cct)
{
// version
(*m)["ceph_version"] = pretty_version_to_str();
(*m)["ceph_version_short"] = ceph_version_to_str();
(*m)["ceph_release"] = ceph_release_to_str();

// kernel info
struct utsname u;
Expand Down
5 changes: 5 additions & 0 deletions src/common/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ const char *ceph_version_to_str(void)
return CEPH_GIT_NICE_VER;
}

const char *ceph_release_to_str(void)
{
return ceph_release_name(CEPH_RELEASE);
}

const char *git_version_to_str(void)
{
return STRINGIFY(CEPH_GIT_VER);
Expand Down
3 changes: 3 additions & 0 deletions src/common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
// Return a string describing the Ceph version
const char *ceph_version_to_str(void);

// Return a string with the Ceph release
const char *ceph_release_to_str(void);

// Return a string describing the git version
const char *git_version_to_str(void);

Expand Down

0 comments on commit 2a745f5

Please sign in to comment.