From 2a745f56c198c297569638de386c95355aef2fd0 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Wed, 28 Mar 2018 12:25:18 +0200 Subject: [PATCH] common: Add metadata with only Ceph version number and release 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 --- src/common/util.cc | 2 ++ src/common/version.cc | 5 +++++ src/common/version.h | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/common/util.cc b/src/common/util.cc index 51bd8b17ea9..af9723bbe79 100644 --- a/src/common/util.cc +++ b/src/common/util.cc @@ -196,6 +196,8 @@ void collect_sys_info(map *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; diff --git a/src/common/version.cc b/src/common/version.cc index 3f882a2b445..5da48ea3679 100644 --- a/src/common/version.cc +++ b/src/common/version.cc @@ -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); diff --git a/src/common/version.h b/src/common/version.h index 3d9d6622ccd..0a84ae442e8 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -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); -- 2.39.5