Skip to content

tentacle: Use /etc/ceph_version to append vendor release version to the version string - #67693

Closed
Naveenaidu wants to merge 2 commits into
ceph:tentaclefrom
Naveenaidu:wip-75368-tentacle
Closed

Naveenaidu wants to merge 2 commits into
ceph:tentaclefrom
Naveenaidu:wip-75368-tentacle

Conversation

@Naveenaidu

Copy link
Copy Markdown
Contributor

@Naveenaidu Naveenaidu added this to the tentacle milestone Mar 6, 2026
@github-actions github-actions Bot added the common label Mar 6, 2026
@Naveenaidu
Naveenaidu requested a review from bill-scales March 6, 2026 11:45
@Naveenaidu Naveenaidu self-assigned this Mar 6, 2026
@Naveenaidu
Naveenaidu requested a review from batrick March 7, 2026 04:45

@bill-scales bill-scales 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.

LGTM - same change as merged in main

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

@batrick can you please approve this PR to be merged into the tentacle branch

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

@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.

No sorry, this cannot be merged and the original PR needs redone.

The larger issue in my eyes is the potential for breakage/confusion of orchestrators like cephadm or rook which very much care about the format of ceph versions. This needs run through their test suites and ACKed that they can tolerate arbitrary strings at the end of each version string. My suggestion would be a separate command for obtaining the downstream version / vendor and make it configured on build time. Sourcing from a random file seems unnecessary when the vendor controls the build.

Comment thread src/common/version.cc

std::string content;
try {
content.assign(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());

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.

This needs some sane limit.

Comment thread src/common/version.cc
@@ -43,6 +47,29 @@ const char *git_version_to_str(void)
return STRINGIFY(CEPH_GIT_VER);
}

static std::string read_vendor_release_file()
{
auto filename = "/etc/ceph_version";

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.

This will not work on alternative platforms. It would need to be configurable.

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

@batrick Thanks for the review. Some context for the PR. The ability to show the vendor version is a downstream only requirement. The discussion related to changes are documented here: https://jsw.ibm.com/browse/ISCE-2817

During the initial discussion of the feature (RADOS team call), we decided against having a new command for showing the downstream version for the sake of maintainability. A separate command for showing the downstream version would be code we'd have to carry only for downstream. The consensus was that a single command showing the full version is semantically cleaner than splitting it across two.

The approach for using a build time configurable option was presented but there was a lot of push back from the build team since they would have to maintain two images - which made us drop that approach. We had a POC for that here . Ref 1, Ref 2

The compromise we arrived was that we use the filename approach to fetch the version string. The build teams is responsible for maintaining the file and this feature was only scoped to the containerized builds - which use centos 9 - Hence the filename being /etc/ceph_version was deemed okay.

The larger issue in my eyes is the potential for breakage/confusion of orchestrators like cephadm or rook

My understanding during the discussion was that - a small prefix to the version string would not cause issue to cephadm or rook. During the testing by the QA team - they used cephadm to deploy the cluster and everything was working as expected. I can definitely get an ACK from those teams saying that they can tolerate arbitrary strings.

The gist is that, this is very much a downstream feature but we have the logic in upstream for better maintainability. We do not intend to bring this feature information in front of our upstream users. (that said, I do understand that if the code is in upstream - users can gleam that information by reading the source!)

cc: @yaarith

@batrick

batrick commented Apr 7, 2026

Copy link
Copy Markdown
Member

@batrick Thanks for the review. Some context for the PR. The ability to show the vendor version is a downstream only requirement. The discussion related to changes are documented here: https://jsw.ibm.com/browse/ISCE-2817

Any relevant discussion should be moved to upstream trackers. We do not have shadow discussions on upstream changes in an IBM forum.

During the initial discussion of the feature (RADOS team call), we decided against having a new command for showing the downstream version for the sake of maintainability. A separate command for showing the downstream version would be code we'd have to carry only for downstream.

I disagree. There could be a ceph vendor command which would be neutral. That can easily be maintained upstream.

The consensus was that a single command showing the full version is semantically cleaner than splitting it across two.

The approach for using a build time configurable option was presented but there was a lot of push back from the build team since they would have to maintain two images - which made us drop that approach.

Okay, so the ask is to make it easier to rebrand (re-vendor) containers built on the same binaries.

That can be achieved in a few ways:

  • A separate .so library for sourcing the vendor version. That can be lightweight enough to trivially rebuild.
  • A new Ceph config for setting the vendor. That can be configured at cluster creation and during upgrade.
  • A container environment variable. Since this two image problem is specific to containers, a container environment variable is a fine solution for the problem. Federico said:

To the question below, I want the build-time definition to be imported and hardcoded, runtime environment variable is not acceptable.

however the container environment variable is static and part of the container image. I don't see an issue here. cc @travisn @adk3798

Since this problem is specific to containers, I would prefer a container environment variable which can override the "build time" setting.

We had a POC for that here . Ref 1, Ref 2

The compromise we arrived was that we use the filename approach to fetch the version string. The build teams is responsible for maintaining the file and this feature was only scoped to the containerized builds - which use centos 9 - Hence the filename being /etc/ceph_version was deemed okay.

Even if it were okay, putting this file in /etc violates the Linux Filesystem Hierarchy Standard. It would go in /usr/lib or somewhere else under /usr.

The larger issue in my eyes is the potential for breakage/confusion of orchestrators like cephadm or rook

My understanding during the discussion was that - a small prefix to the version string would not cause issue to cephadm or rook. During the testing by the QA team - they used cephadm to deploy the cluster and everything was working as expected. I can definitely get an ACK from those teams saying that they can tolerate arbitrary strings.

It's needs to be tested there too. This is not a small change as it could break upgrades in surprising ways that cannot be anticipated until it's in the wild.

The gist is that, this is very much a downstream feature but we have the logic in upstream for better maintainability. We do not intend to bring this feature information in front of our upstream users. (that said, I do understand that if the code is in upstream - users can gleam that information by reading the source!)

Once it's upstream then it becomes our problem to maintain. Distributions may decide to put "Debian" in this vendor string once it's available (and honestly, that seems appropriate, no?).

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

Any relevant discussion should be moved to upstream trackers. We do not have shadow discussions on upstream changes in an IBM forum.

Understood, I will be conscious of the fact moving forward. Apologies about that.

If I understand correctly - you are suggesting the following:

Create a new command called ceph vendor which will read the value from an environment variable. For downstream, the environment variable will be created by the build team during the creation of container image and hence will be static.

One question:

  1. What do you think the default value of ceph vendor should be for the upstream image - if the environment variable is not set, An empty string ?
    • One issue I see with this approach is that, in non containerized setups - users can go in and change the value of the environment variable of a running cluster - which might mean that the values from the ceph vendor command will be runtime dependent on the environment variable ?
      • Is this acceptable ? I had a PR with this approach here, but dropped it for this concern.

Since this problem is specific to containers, I would prefer a container environment variable which can override the "build time" setting.

Sorry, can you please clarify by a "build time" setting. Please correct me if I am wrong, are you suggesting that we have the vendor version be built in during the build time and also have an environment variable to override the value ?

It's needs to be tested there too. This is not a small change as it could break upgrades in surprising ways that cannot be anticipated until it's in the wild.

Noted!

@batrick

batrick commented Apr 7, 2026

Copy link
Copy Markdown
Member

Any relevant discussion should be moved to upstream trackers. We do not have shadow discussions on upstream changes in an IBM forum.

Understood, I will be conscious of the fact moving forward. Apologies about that.

If I understand correctly - you are suggesting the following:

Create a new command called ceph vendor which will read the value from an environment variable. For downstream, the environment variable will be created by the build team during the creation of container image and hence will be static.

One question:

1. What do you think the default value of `ceph vendor` should be for the upstream image - if the environment variable is not set, An empty string ?

default of "ceph.io" or similar seems good for the RPM/containers we produce.

   * One issue I see with this approach is that, in non containerized setups - users can go in and change the value of the environment variable of a running cluster - which might mean that the values from the `ceph vendor` command will be runtime dependent on the environment variable ?

If this is truly undesirable, you can enable the envvar lookup via a build time config.

     * Is this acceptable ? I had a PR with this approach [here](https://github.com/ceph/ceph/pull/66719), but dropped it for this concern.

I don't really think it's a concern.

Since this problem is specific to containers, I would prefer a container environment variable which can override the "build time" setting.

Sorry, can you please clarify by a "build time" setting. Please correct me if I am wrong, are you suggesting that we have the vendor version be built in during the build time and also have an environment variable to override the value ?

Yes. A build time setting would be a define when running cmake.

@parth-gr

parth-gr commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

@batrick What is the use case of adding a new spec? do we need to make use of the new vendor release version spec?
If not we can just ignore that and current marshling of the version spec json should work.

@batrick

batrick commented Apr 7, 2026

Copy link
Copy Markdown
Member

@batrick What is the use case of adding a new spec? do we need to make use of the new vendor release version spec? If not we can just ignore that and current marshling of the version spec json should work.

This code as-is would add an arbitrary string to: pretty_version_to_str. That would (at the very least) potentially impact upgrade procedures that look at that string.

@travisn

travisn commented Apr 7, 2026

Copy link
Copy Markdown
Member

Rook very much relies on parsing the ceph version to determine the upstream version with the following procedure:

  1. Run ceph --version
    a. sample output: ceph version 20.2.0 (69f84cc2651aa259a15bc192ddaabd3baba07489) tentacle (stable)
  2. Look for a substring in the output with this regex: ceph version (\d+)\.(\d+)\.(\d+)
    a. For example, major=20, minor=2, extra=0
  3. Also extract the commit hash and build version if there.

I believe extra info on the end of the output of ceph --version will not interfere with Rook's version extraction, but I would certainly want to test to confirm.

Rook also runs ceph versions to get daemon versions, but IIRC we don't extra exact version fields, we are just checking during upgrade if all daemons are on the same Ceph version, or if there are still multiple ceph versions running on different daemons.

@yaarith

yaarith commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

@batrick thanks for reviewing.

It’s a good idea to make filename below configurable:

auto filename = "/etc/ceph_version";

and have it by default under /usr/lib.

If upgrade tests are working as expected, and we have confirmation from cephadm and rook that it is safe to rely on the ceph version and ceph versions commands output that includes these changes -- what would be the main concern with continuing the current approach?

@batrick

batrick commented Apr 8, 2026

Copy link
Copy Markdown
Member

@batrick thanks for reviewing.

It’s a good idea to make filename below configurable:

auto filename = "/etc/ceph_version";

and have it by default under /usr/lib.

If upgrade tests are working as expected, and we have confirmation from cephadm and rook that it is safe to rely on the ceph version and ceph versions commands output that includes these changes -- what would be the main concern with continuing the current approach?

I have a few concerns:

  • The result of ceph version during the course of the daemon's lifetime can change due to changes on the file system (e.g. package upgrade)
  • Only having the vendor string configurable by a file is unusual and opens the door to future asks where we put other version information in file(s).
  • The daemon opens/reads a file whenever they generate version metadata (which is actually frequent).
  • An environment variable for the container file solves this problem neatly without adding a vendor file.

Introduce a build-time mechanism to allow vendors or downstream
distributions to append their release/version metadata to the output of
ceph version and ceph versions.

The release string is read from the file `/etc/ceph_version` and appends
it to the version string as `release <value>`. If no value is supplied
or the file is empty, the version output remains unchanged.

Example:
If the `/etc/ceph_version` file has "8.1.0" as string then,
ceph version 8d7daada90 (98d7daa) tentacle (dev - Debug) release 8.1.0

Signed-off-by: Naveen Naidu <[email protected]>
(cherry picked from commit 541439b)
read_vendor_release_file() reads /etc/ceph_version which may have a
trailing newline, causing "ceph version" to produce invalid JSON output.
Strip trailing \n and \r characters before returning the content.

Signed-off-by: Naveen Naidu <[email protected]>
(cherry picked from commit 5022557)
@Naveenaidu

Copy link
Copy Markdown
Contributor Author

A new tracker has been created here: https://tracker.ceph.com/issues/75954, which points out the next steps on how to proceed. TL:DR is we will be going with the ceph_version file approach but with more guardrails, better performance and improved testing

@idryomov

Copy link
Copy Markdown
Contributor

TL:DR is we will be going with the ceph_version file approach but with more guardrails, better performance and improved testing

From my perspective, it's just plain impossible to sufficiently "guardrail" any approach that is based on a file that is read at runtime, whether it's attempted to be done just once at startup or not. The version information needs to be physically baked into the binaries (such that it can be reconstructed from strings <path to binary> output). Anything short of that seems wrong -- it would not only be unprecedented but also potentially insecure and go against

Federico said:

To the question below, I want the build-time definition to be imported and hardcoded, runtime environment variable is not acceptable.

@idryomov

idryomov commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

The approach for using a build time configurable option was presented but there was a lot of push back from the build team since they would have to maintain two images - which made us drop that approach. We had a POC for that here .

If the desire is to be able to produce two differently versioned container images from the same set of binaries, wouldn't two container images need to be maintained no matter what? Assuming the file-based approach for the sake of argument, one would have a container image with a file with version tag A and another with a file with version tag B. Or am I completely misunderstanding the goal here?

Separately, is it guaranteed that the set of binaries in question would always be the same? If there are two different container image flavors on the table it seems only natural that at some point the different version tags wouldn't be the only difference between them.

@Naveenaidu

Naveenaidu commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@bigjust tagging you to help answer the pain points from build team POV and why we don't want to have a baked-in defaults

@bigjust

bigjust commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

The approach for using a build time configurable option was presented but there was a lot of push back from the build team since they would have to maintain two images - which made us drop that approach. We had a POC for that here .

Don't want to confuse maintaining two images with maintaining two rpm builds. Our goal is to build the Ceph RPMs once, and deploy them to separately maintained container images.

If the desire is to be able to produce two differently versioned container images from the same set of binaries, wouldn't two container images need to be maintained no matter what? Assuming the file-based approach for the sake of argument, one would have a container image with a file with version tag A and another with a file with version tag B. Or am I completely misunderstanding the goal here?

That is correct.

Separately, is it guaranteed that the set of binaries in question would always be the same? If there are two different container image flavors on the table it seems only natural that at some point the different version tags wouldn't be the only difference between them.

If we keep to our goal of only building the RPMs once, then they should be the same. I do believe that feature flagging between the two variants would be a very real need as well.

@Naveenaidu

Copy link
Copy Markdown
Contributor Author

the summary of the discussion of this PR has been documented here: https://tracker.ceph.com/issues/76134.

The revert PR for the main commits are here: #68479

We will be closing this PR in favour of #66730

@Naveenaidu Naveenaidu closed this Apr 20, 2026
Naveenaidu added a commit to Naveenaidu/ceph that referenced this pull request Apr 21, 2026
Revert "src/common/version: append vendor release to ceph version(s) output"

This reverts commits 5022557 and
541439b.

As discussed in ceph#67693, using a
file-based approach to get the vendor version is not safe or correct.
We are reverting this and will instead work on an approach where the
version string is baked into the binary at build time.

Fixes: https://tracker.ceph.com/issues/76134
Signed-off-by: Naveen Naidu <[email protected]>
AnuragRaut08 pushed a commit to AnuragRaut08/ceph that referenced this pull request Sep 30, 2026
Revert "src/common/version: append vendor release to ceph version(s) output"

This reverts commits 5022557 and
541439b.

As discussed in ceph#67693, using a
file-based approach to get the vendor version is not safe or correct.
We are reverting this and will instead work on an approach where the
version string is baked into the binary at build time.

Fixes: https://tracker.ceph.com/issues/76134
Signed-off-by: Naveen Naidu <[email protected]>
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.

10 participants