Skip to content

src/common/version: Improve logic for handling the vendor version - #68356

Closed
Naveenaidu wants to merge 4 commits into
ceph:mainfrom
Naveenaidu:wip-naveen-downstream-vendor-approach-2
Closed

Naveenaidu wants to merge 4 commits into
ceph:mainfrom
Naveenaidu:wip-naveen-downstream-vendor-approach-2

Conversation

@Naveenaidu

@Naveenaidu Naveenaidu commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

The PR #67299 added a feature will allowed vendors to their release version information to the output of the ceph version(s) command. As discussed here #67693, there are some issues with the approach taken in the PR.

This PR aims at solving them, in this we do the following:

  1. ceph_vendor_version_file config options has been added, to allow users to decide where to fetch the vendor release information from
  2. Instead of open/close-ing the file - the value of the file is now cache during the startup of the cluster. This avoid unnecessary file read calls
  3. A sane character limit (256 bytes) is set for reading the file - to avoid any issues.

For reference, the output of the commands looks like the follows:

The version output becomes

> ceph version

ceph version 8d7daada90 (98d7daada90c6585c6724f69793e804a5e23cb24) tentacle (dev - Debug) vendor 8.1.0

The same suffix is reflected consistently for ceph versions

> ceph versions
{
    "mon": {
        "ceph version 8d7daada90 (98d7daada90c6585c6724f69793e804a5e23cb24) tentacle (dev - Debug) vendor 8.1.0": 3
    },
    "mgr": {
        "ceph version 8d7daada90 (98d7daada90c6585c6724f69793e804a5e23cb24) tentacle (dev - Debug) vendor 8.1.0": 1
    },
    "osd": {
        "ceph version 8d7daada90 (98d7daada90c6585c6724f69793e804a5e23cb24) tentacle (dev - Debug) vendor 8.1.0": 3
    },
    "mds": {
        "ceph version 8d7daada90 (98d7daada90c6585c6724f69793e804a5e23cb24) tentacle (dev - Debug) vendor 8.1.0": 3
    },
    "overall": {
        "ceph version 8d7daada90 (98d7daada90c6585c6724f69793e804a5e23cb24) tentacle (dev - Debug) vendor 8.1.0": 10
    }
}

Fixes: https://tracker.ceph.com/issues/75954

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions

Copy link
Copy Markdown

Config Diff Tool Output

+ added: ceph_vendor_version_file (global.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@Naveenaidu
Naveenaidu marked this pull request as ready for review April 14, 2026 13:27
@Naveenaidu Naveenaidu self-assigned this Apr 14, 2026
@Naveenaidu
Naveenaidu requested a review from batrick April 14, 2026 13:27
@Naveenaidu

Naveenaidu commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor Author

We need ACK from the rook and cephadm teams to know if an addition of the release <version-no> prefix suffix to the ceph version and ceph versions command as mentioned in PR description is okay from their side.

Is there anything from my side that I can do for testing this in rook and cephadm test suites ?

cc: @travisn (for rook) and @rkachach , @adk3798 (for cephadm)

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty_version_to_str will also need to take a CephContext* to access the vendor string.

I think you can also simplify your file reading code (use Gemini to help improve it).

Comment thread src/global/global_init.cc Resolved
Comment thread src/common/version.cc Resolved
Comment thread src/common/options/global.yaml.in Resolved
Comment thread src/common/version.cc Resolved
Comment thread src/common/options/global.yaml.in Resolved
Comment thread src/common/version.cc Resolved
Comment thread src/common/version.cc Resolved
@rkachach

rkachach commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

We need ACK from the rook and cephadm teams to know if an addition of the release <version-no> prefix to the ceph version and ceph versions command as mentioned in PR description is okay from their side.

Is there anything from my side that I can do for testing this in rook and cephadm test suites ?

cc: @travisn (for rook) and @rkachach , @adk3798 (for cephadm)

I have to check the rest of the code but cephadm does rely on that command for upgrade process in a couple of spots:

https://github.com/ceph/ceph/blob/main/src/pybind/mgr/cephadm/upgrade.py#L228-L231

    def _get_current_version(self) -> Tuple[int, int, str]:
        current_version = self.mgr.version.split('ceph version ')[1]
        (current_major, current_minor, _) = current_version.split('-')[0].split('.', 2)
        return (int(current_major), int(current_minor), current_version)

and:

https://github.com/ceph/ceph/blob/main/src/pybind/mgr/cephadm/module.py#L4108-L4112

        ceph_image_version = image_info.ceph_version
        if not ceph_image_version:
            return f'Unable to extract ceph version from {target_name}.'
        if ceph_image_version.startswith('ceph version '):
            ceph_image_version = ceph_image_version.split(' ')[2]

Maybe @adk3798 is aware of other implications related with the upgrade. Anyway, I have to check the rest of the code carefully to see if there's other spots where the cmd is used ....

@travisn

travisn commented Apr 14, 2026 •

Copy link
Copy Markdown
Member

We need ACK from the rook and cephadm teams to know if an addition of the release <version-no> prefix to the ceph version and ceph versions command as mentioned in PR description is okay from their side.

@Naveenaidu I believe Rook will be ok. We could run our test suites against it, if there is an image pushed somewhere to quay.

And to clarify, will it be a suffix or a prefix? From the PR description, it looks like just a suffix being appended at the end?

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

We need ACK from the rook and cephadm teams to know if an addition of the release <version-no> prefix to the ceph version and ceph versions command as mentioned in PR description is okay from their side.

@Naveenaidu I believe Rook will be ok. We could run our test suites against it, if there is an image pushed somewhere to quay.

Thanks Travis, will update you once an image is pushed to quay!

And to clarify, will it be a suffix or a prefix? From the PR description, it looks like just a suffix being appended at the end?

My apologies, it's a suffix - I will update the comment. The extra string will be appended at the end

@Naveenaidu
Naveenaidu requested a review from a team as a code owner April 15, 2026 09:39

@idryomov idryomov left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like RBD got tagged just because of a mechanical change that adds CephContext parameter to a common method, but since I have taken a look I'm going to leave my opinion.

Neither the original (#67299) nor this PR seem right to me. The version information has to be baked into the build artifacts at build time, it can't be fetched from some (configurable!) file at runtime -- at that point it's essentially a way to get ceph version and related commands to return a random string that no one could trust. I also don't see a valid reason for pretty_version_to_str() to take CephContext or any other parameter of similar weight. The only parameter that I'd consider acceptable for pretty_version_to_str() would be something along the lines include_vendor bool -- the fact that it currently takes no parameters is very much intended.

@Naveenaidu
Naveenaidu force-pushed the wip-naveen-downstream-vendor-approach-2 branch from da7b645 to 40e4850 Compare April 16, 2026 05:15
@Naveenaidu
Naveenaidu requested a review from a team as a code owner April 16, 2026 05:15
@Naveenaidu
Naveenaidu force-pushed the wip-naveen-downstream-vendor-approach-2 branch 2 times, most recently from ad9938e to e3c401d Compare April 16, 2026 12:36
The ceph_vendor_version_file config options allows users to configure
where the release file for ceph vendor is present. The content of this
file is read during the initialization of the cluster.

The vendor version is stored in a static variable so that the vendor
file is not opened/closed everytime the version metadata is created for
daemons

Fixes: https://tracker.ceph.com/issues/75954

Signed-off-by: Naveen Naidu <[email protected]>
@Naveenaidu
Naveenaidu force-pushed the wip-naveen-downstream-vendor-approach-2 branch from e3c401d to 39521cd Compare April 16, 2026 12:39
@Naveenaidu
Naveenaidu force-pushed the wip-naveen-downstream-vendor-approach-2 branch from 39521cd to 1f8fd6f Compare April 16, 2026 12:40
@Naveenaidu
Naveenaidu requested a review from batrick April 16, 2026 12:42

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love making the vendor string conditional on having the cct*. However I also don't have a better recommendation except perhaps we could make it static variable again.

Comment thread src/global/global_init.cc
}

g_ceph_context->set_vendor_version_file(
g_conf().get_val<std::string>("ceph_vendor_version_file"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everything goes through global init. E.g. library clients will not. This needs to be moved to initialization of the CephContext.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did not add set_vendor_version_file in the initialization of CephContext is because the configuration files are not parsed during the CephContext::CephContext. If we called set_vendor_version_file inside CephContext::CephContext then the ceph_vendor_version_file would still be in it;s compiled-in default - ignoring anything in ceph.conf.

Is there a better place for this?

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

I don't love making the vendor string conditional on having the cct*. However I also don't have a better recommendation except perhaps we could make it static variable again.

I agree, I do not the vendor string being conditional on having the cct*, I would very much prefer making it a static variable. If you are okay with that option - I can revert the commit involving the passing of cct to pretty_verstion_to_str

@dmick

dmick commented Apr 17, 2026

Copy link
Copy Markdown
Member

I know I'm late to this, but I really am not happy about using the name /etc/ceph_version either; it's a very specific addendum to the version and should be clearly labeled. at least /etc/ceph_vendor_version_extension or something like it.

@Naveenaidu

Naveenaidu commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor Author

The approach taken in this PR is incorrect, we do not want version string to be runtime dependent. It is unsafe and violates the schemantics of version string. The next steps are documented here: https://tracker.ceph.com/issues/76134

The original commits are being reverted in this PR: #68479

This PR would now be closed in favour of #66730 where we will have the version baked into the binary

@Naveenaidu Naveenaidu closed this Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants