[pve-devel] [PATCH v3 pve-manager 5/5] fix #5366: api: ceph: change version format in OSD metadata endpoint

Max Carrara m.carrara at proxmox.com
Wed Jul 24 17:05:11 CEST 2024


.. in order to include Ceph's build commit. Instead of e.g.

  18.2.2 (reef)

the string will now contain:

  18.2.2 (build: e9fe820e7) reef

This format is used in the OSD detail view; the build commit will
therefore also be shown there.

Signed-off-by: Max Carrara <m.carrara at proxmox.com>
Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=5366
---
Changes v2 --> v3:
  * put 'build: ' in front of build commit (thanks Thomas!)
  * reword commit title
  * add 'Fixes' trailer

Changes v1 --> v2:
  * NEW

 PVE/API2/Ceph/OSD.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index 1ff51fbd..88b7142b 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -747,6 +747,12 @@ __PACKAGE__->register_method ({
 	my $osd_pss_memory = eval { get_proc_pss_from_pid($pid) } // 0;
 	warn $@ if $@;
 
+	my ($ceph_version, $ceph_buildcommit) = PVE::Ceph::Tools::parse_ceph_version(
+	    $metadata->{ceph_version}
+	);
+
+	$ceph_buildcommit = substr($ceph_buildcommit, 0, 9);
+
 	my $data = {
 	    osd => {
 		hostname => $metadata->{hostname},
@@ -755,7 +761,7 @@ __PACKAGE__->register_method ({
 		osd_data => $metadata->{osd_data},
 		osd_objectstore => $metadata->{osd_objectstore},
 		pid => $pid,
-		version => "$metadata->{ceph_version_short} ($metadata->{ceph_release})",
+		version => "$ceph_version (build: $ceph_buildcommit) $metadata->{ceph_release}",
 		front_addr => $metadata->{front_addr},
 		back_addr => $metadata->{back_addr},
 		hb_front_addr => $metadata->{hb_front_addr},
-- 
2.39.2





More information about the pve-devel mailing list