Skip to content

mgr/rook: select InternalIP for HostSpec.addr instead of slash-joinin… - #69250

Merged
rkachach merged 1 commit into
ceph:mainfrom
kozhukalov:mgr-rook-get-hosts-internal-ip
Sep 24, 2026
Merged

rkachach merged 1 commit into
ceph:mainfrom
kozhukalov:mgr-rook-get-hosts-internal-ip

Conversation

@kozhukalov

@kozhukalov kozhukalov commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

mgr/rook: select InternalIP for HostSpec.addr instead of slash-joining all node addresses

get_hosts() built HostSpec.addr with '/'.join() over every entry in node.status.addresses, producing strings like "10.248.0.3/np6b438a15bf1a4" (InternalIP + Hostname). The orchestrator interface documents addr as a single "dns name or IP", and consumers treat it as one resolvable address.

Concrete symptom: mgr/nfs resolve_ip() calls socket.getaddrinfo() on the joined string and fails with:

Error EINVAL: Cannot resolve IP for host 10.248.0.3/np6b438a15bf1a4:
[Errno -2] Name or service not known

(seen via Manila's CephFS driver calling ceph nfs cluster info). The malformed value is also visible directly in ceph orch host ls. Any consumer of HostSpec.addr that resolves it as an IP is affected.

Fix get_hosts() to pick a single address: prefer InternalIP (always present on managed nodes and routable cluster-internally), falling back to the first address. The hostname is already carried as HostSpec's name, so nothing is lost.

Also harden mgr/nfs resolve_ip() to strip the legacy "/" format, so a newer mgr keeps working against older Rook backends still emitting it.

Add unit tests for get_hosts() covering InternalIP preference, the fallback path, and the empty-address case.

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

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.

@kozhukalov
kozhukalov requested a review from a team as a code owner June 2, 2026 17:39
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

16 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@kozhukalov
kozhukalov force-pushed the mgr-rook-get-hosts-internal-ip branch from bec590f to 0dbefc9 Compare June 3, 2026 18:38
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jun 3, 2026
* Update openstack-helm from branch 'master'
  to d3fa14f5129df62a449dd466f0f09e99bf5c291f
  - Merge "[manila] Add optional StatefulSet for manila-share"
  - [manila] Add optional StatefulSet for manila-share
    
    The static host value (conf.manila.DEFAULT.host) keeps the manila-share
    service identity stable across pod restarts, but it is only safe with
    a single replica: every pod registers under the same host and competes
    for the same RPC queue, periodic tasks, and (without a Tooz backend)
    uncoordinated locks.
    
    Add an optional StatefulSet manifest for manila-share, gated by
    manifests.statefulset_share (disabled by default). When enabled, the
    existing deployment_share manifest is suppressed and each pod gets a
    stable, unique hostname (manila-share-0, manila-share-1, ...). The
    manila-share.sh script now derives the host from ${HOSTNAME} and
    appends a per-pod --config-file when conf.manila.DEFAULT.host is left
    empty, so each replica registers under its own pod name. The HOSTNAME
    env var is sourced from metadata.name so it is correct even with the
    existing hostNetwork: true on share pods.
    
    Comments are added in values.yaml next to the host field and the new
    manifests.statefulset_share flag to document the single-replica caveat
    and how to switch to the StatefulSet for predictable hostnames.
    
    - The manila deployment test job is added that deploys Manila with
    CephFS as backend. The Ceph MGR Rook module is patched. See details
    ceph/ceph#69250
    
    - The helm-toolkit utility template _to_oslo_conf.tpl is updated to
    stop rendering nil values. Now users can explicitly set some values to
    null and they will not be rendered at all instead of to be rendered as
    invalid "<no value>".
    
    Signed-off-by: Vladimir Kozhukalov <[email protected]>
    Change-Id: Id0185812dea09200ce4310127b79a2731b68efaa
openstack-mirroring pushed a commit to openstack/openstack-helm that referenced this pull request Jun 3, 2026
The static host value (conf.manila.DEFAULT.host) keeps the manila-share
service identity stable across pod restarts, but it is only safe with
a single replica: every pod registers under the same host and competes
for the same RPC queue, periodic tasks, and (without a Tooz backend)
uncoordinated locks.

Add an optional StatefulSet manifest for manila-share, gated by
manifests.statefulset_share (disabled by default). When enabled, the
existing deployment_share manifest is suppressed and each pod gets a
stable, unique hostname (manila-share-0, manila-share-1, ...). The
manila-share.sh script now derives the host from ${HOSTNAME} and
appends a per-pod --config-file when conf.manila.DEFAULT.host is left
empty, so each replica registers under its own pod name. The HOSTNAME
env var is sourced from metadata.name so it is correct even with the
existing hostNetwork: true on share pods.

Comments are added in values.yaml next to the host field and the new
manifests.statefulset_share flag to document the single-replica caveat
and how to switch to the StatefulSet for predictable hostnames.

- The manila deployment test job is added that deploys Manila with
CephFS as backend. The Ceph MGR Rook module is patched. See details
ceph/ceph#69250

- The helm-toolkit utility template _to_oslo_conf.tpl is updated to
stop rendering nil values. Now users can explicitly set some values to
null and they will not be rendered at all instead of to be rendered as
invalid "<no value>".

Signed-off-by: Vladimir Kozhukalov <[email protected]>
Change-Id: Id0185812dea09200ce4310127b79a2731b68efaa
@kozhukalov

Copy link
Copy Markdown
Contributor Author

ok - to - test

@kozhukalov

Copy link
Copy Markdown
Contributor Author

ok to test

@vshankar
vshankar requested a review from travisn June 23, 2026 07:47

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

@kozhukalov Can you provide more background for how this impacts Rook clusters? Does it impact the dashboard, or something else? The rook mgr module is often not even enabled in Rook, since we don't have good testing.

@kozhukalov

kozhukalov commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@kozhukalov Can you provide more background for how this impacts Rook clusters? Does it impact the dashboard, or something else? The rook mgr module is often not even enabled in Rook, since we don't have good testing.

@travisn Sure. I am working mostly with the Openstack-Helm project which deploys Openstack on top of Kubernetes. One of our test jobs deploys Openstack Manila (File Storage as a Service). This particular test job configures Manila to utilize CephFS as its backend with Rook managed Ceph cluster.

The Manila CephFS driver tries to run the command ceph nfs cluster info <cluster> [1] to get the nfs export IPs which fails due to this issue because it tries to call getaddrinfo() on the / joined string "<ip>/<hostname>".

See the line [2]. When it constructs the list of HostSpec instances it sets the addr of every item as / joined string of multiple values InternalIP, ExternalIP, Hostname that the V1NodeAddress K8s API object enumerates. However the addr property of the HostSpec must be a single IP address or hostname [3]. Orchestrator consumers (mgr/nfs, mgr/dashboard, ...) treat HostSpec.addr as a single IP/hostname and call socket.getaddrinfo() on it.

The PR suggests to use the internal IP and fallback to first address from the list. Also for nfs it updates the resolve_ip to make it tolerant to "<ip>/<hostname>".

[1] https://opendev.org/openstack/manila/src/branch/master/manila/share/drivers/cephfs/driver.py#L1597
[2] https://github.com/ceph/ceph/blob/main/src/pybind/mgr/rook/rook_cluster.py#L897
[3] https://github.com/ceph/ceph/blob/main/src/python-common/ceph/deployment/hostspec.py#L66-L67

@kozhukalov

Copy link
Copy Markdown
Contributor Author

@travisn Is there anything else I could do regarding this PR to help the review?

@travisn

travisn commented Jul 6, 2026

Copy link
Copy Markdown
Member

The explanation sounds good to me, I don't have other feedback, thanks.

@rkachach
rkachach requested a review from ShwetaBhosale1 July 24, 2026 09:57
@kozhukalov

Copy link
Copy Markdown
Contributor Author

@ShwetaBhosale1, can you please take a look at the PR? Is there anything I can do to help with the review?

@gregsfortytwo gregsfortytwo added needs-qa cephfs Ceph File System labels Aug 5, 2026

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

This looks fine to me and @travisn is okay with it.

Adding needs-qa and CephFS labels so we can pick it up and make sure the nfs module didn't break anything before merge.

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

Changes LGTM!

@kozhukalov

Copy link
Copy Markdown
Contributor Author

ok to test

@kozhukalov

Copy link
Copy Markdown
Contributor Author

@vshankar @ShwetaBhosale1 What else can I do to help merge the PR?

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@vshankar

Copy link
Copy Markdown
Contributor

@vshankar @ShwetaBhosale1 What else can I do to help merge the PR?

@rkachach @travisn - can this be picked up for QA?

@travisn

travisn commented Aug 27, 2026

Copy link
Copy Markdown
Member

@vshankar @ShwetaBhosale1 What else can I do to help merge the PR?

@rkachach @travisn - can this be picked up for QA?

Yes, though it needs a rebase now.

…g all node addresses

get_hosts() built HostSpec.addr with '/'.join() over every entry in
node.status.addresses, producing strings like "10.248.0.3/np6b438a15bf1a4"
(InternalIP + Hostname). The orchestrator interface documents addr as a
single "dns name or IP", and consumers treat it as one resolvable address.

Concrete symptom: mgr/nfs resolve_ip() calls socket.getaddrinfo() on the
joined string and fails with:

  Error EINVAL: Cannot resolve IP for host 10.248.0.3/np6b438a15bf1a4:
  [Errno -2] Name or service not known

(seen via Manila's CephFS driver calling `ceph nfs cluster info`). The
malformed value is also visible directly in `ceph orch host ls`. Any
consumer of HostSpec.addr that resolves it as an IP is affected.

Fix get_hosts() to pick a single address: prefer InternalIP (always
present on managed nodes and routable cluster-internally), falling back
to the first address. The hostname is already carried as HostSpec's name,
so nothing is lost.

Also harden mgr/nfs resolve_ip() to strip the legacy "<ip>/<hostname>"
format, so a newer mgr keeps working against older Rook backends still
emitting it.

Add unit tests for get_hosts() covering InternalIP preference, the
fallback path, and the empty-address case.

Fixes: https://tracker.ceph.com/issues/77100
Signed-off-by: Vladimir Kozhukalov <[email protected]>
@kozhukalov
kozhukalov force-pushed the mgr-rook-get-hosts-internal-ip branch from 0dbefc9 to 7ac3211 Compare August 27, 2026 19:46
@kozhukalov

kozhukalov commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

@travisn
The PR is rebased now.

fivetime added a commit to fivetime/openstack-helm-images that referenced this pull request Sep 7, 2026
Ships the RWX half of the tenant storage story. The driver published a
Manila StorageClass only when the cluster carried a
manila_csi_share_network_id label, so on this DHSS=False cloud the Manila
CSI plugin was installed, running, healthy and useless: nine Cinder RWO
StorageClasses and no RWX one. It now gates on the share type's
driver_handles_share_servers instead, and omits shareNetworkID when unset.

Held back until now on purpose. Manila could not serve an NFS share at all
while ceph/ceph#69250 broke `ceph nfs cluster info`, and shipping this
earlier would only have moved the failure from "no StorageClass" to "a
StorageClass whose PVCs never bind". That is fixed as of today: the cluster
runs ghcr.io/fivetime/ceph:v20.2.4-fivetime-201f4994d34f, Manila has a
cephfsnfs backend up beside cephfsnative, and a test NFS share came back
with export location 10.32.16.68:/volumes/_nogroup/... and a live Ganesha
export.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017xWtySCN31tS8CrJWo3sRo
fivetime added a commit to fivetime/ceph that referenced this pull request Sep 8, 2026
The three mgr Python files are copied unconditionally, and they are cut from
v20.2.4. Rebuilding this against a newer base -- which is what anyone would do
to pick up an unrelated fix in v20.2.5 -- would overwrite files upstream had
already fixed with stale ones, silently. That is exactly the trap that makes a
throwaway overlay outlive its usefulness.

So inspect the base first and fail, naming the part that has become redundant:

  ERROR: base image quay.io/ceph/ceph:v20.2.5 already carries: ceph#69250(mgr/rook)
  This overlay has outlived that part. Retire it instead of rebuilding.

Verified both directions, because a guard that cannot fire proves nothing:
against quay.io/ceph/ceph:v20.2.4 it prints "base still needs all three fixes"
and the build completes; against this overlay's own output it names all three
(ceph#69250, ceph#70967, nfs-ganesha 9.16) and exits 1.

BASE_IMAGE is re-declared after FROM: an ARG from before the first FROM is out
of scope inside the stage, so the error would otherwise name no image.

README gains the retirement procedure and the one command that decides it,
which needs no knowledge of which PRs merged.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017xWtySCN31tS8CrJWo3sRo
@rkachach

Copy link
Copy Markdown
Contributor

ok to test

@rkachach

Copy link
Copy Markdown
Contributor

ok to test

@rkachach

Copy link
Copy Markdown
Contributor

@rkachach
rkachach merged commit 4b4e4f7 into ceph:main Sep 24, 2026
16 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log 4b4e4f7cf2927fb57b5805c3a4de78fadf0cf79a^..4b4e4f7cf2927fb57b5805c3a4de78fadf0cf79a

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/36000943474

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.

7 participants