Skip to content

mgr/cephadm: optionally pre-pull target image on all hosts before upgrade - #69358

Closed
FredNass wants to merge 3 commits into
ceph:mainfrom
FredNass:wip-cephadm-upgrade-pre-pull
Closed

FredNass wants to merge 3 commits into
ceph:mainfrom
FredNass:wip-cephadm-upgrade-pre-pull

Conversation

@FredNass

@FredNass FredNass commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

On clusters with many hosts and a large container image (ceph upstream container image is 1.2GB in size), cephadm's on-demand image pulls (one per host, just before the first daemon on that host is upgraded) are performed serially as the upgrade progresses and add up to a significant share of the total upgrade time.

This is especially harmful when upgrading MDS daemons. The MDS upgrade fails (or scales down) the filesystem first, and only then redeploys its MDS, which pulls the target image on the host as part of the redeployment. The image download therefore happens while the filesystem is already offline, so the pull time is counted directly against filesystem unavailability and is felt by CephFS clients. Pulling a large image on a host that does not yet have it can take a while, needlessly extending the outage.

Add an optional phase that, before any daemon is upgraded (and before any filesystem is failed), pulls the target image in parallel on every host in the upgrade scope, capped by upgrade_max_parallel_image_pulls (default 8) to avoid overwhelming the registry. The subsequent per-daemon pull then becomes a no-op, so MDS redeployment no longer waits on an image download while the filesystem is down.

Hosts that already have the target image are skipped, and each pull is logged per host with progress. When the upgrade is scoped (--hosts/--services/--daemon-types), only hosts with a daemon in scope are pre-pulled. If the image cannot be pulled on any host, the upgrade is paused before any daemon is touched and the failing host(s) and reason are surfaced in the cluster status, so no daemon is left down while the issue (often a full disk) is resolved.

Successfully tested on a Reef v18.2.8 cluster, with the expected behavior.

Opt-in via the following setting:
ceph config set mgr mgr/cephadm/upgrade_pre_pull_images true

Optionally, tune the parallelism (default 8):
ceph config set mgr mgr/cephadm/upgrade_max_parallel_image_pulls 8

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

Assisted-by: Claude Opus 4.8 High

Expected behavior successfully validated in the lab on a live Ceph cluster.

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.

@FredNass
FredNass requested review from a team as code owners June 9, 2026 12:24
@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.

@FredNass

FredNass commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Test environment:

MGRs on v18.2.8, with patched upgrade.py and module.py mounted via extra -v mounts in unit.run. Upgrading to v19.2.4 with ceph orch upgrade start --image quay.io/ceph/ceph:v19.2.4.

For this test, I filled the disk on host r01h01 with fallocate -l 20.8G huge_file to trigger ENOSPC and block the pre-pull (and the upgrade) on that host. On some other hosts, I ran podman image prune -a to remove the already-downloaded image, to show how the pre-pull behaves when the image is already present versus when it has to be pulled.

Below is example output from the orchestrator logs (ceph.cephadm.log, log_to_cluster_level set to info):

2026-06-09T12:39:26.631912+0000 mgr.r03h01.nhzteq (mgr.43421861) 2368 : cephadm [INF] Upgrade: Started with target quay.io/ceph/ceph:v19.2.4
2026-06-09T12:39:26.989913+0000 mgr.r03h01.nhzteq (mgr.43421861) 2369 : cephadm [INF] Upgrade: First pull of quay.io/ceph/ceph:v19.2.4
2026-06-09T12:39:47.193886+0000 mgr.r03h01.nhzteq (mgr.43421861) 2380 : cephadm [INF] Upgrade: Target is version 19.2.4 (unknown)
2026-06-09T12:39:47.193970+0000 mgr.r03h01.nhzteq (mgr.43421861) 2381 : cephadm [INF] Upgrade: Target container is quay.io/ceph/ceph@sha256:4940f3e4da8077b68e577c2dcbf313c7c2f9c3b61654c52fcb28884a6ef96a7b, digests ['quay.io/ceph/ceph@sha256:4940f3e4da8077b68e577c2dcbf313c7c2f9c3b61654c52fcb28884a6ef96a7b', 'quay.io/ceph/ceph@sha256:81389a0dc83f2e4d6d86641848e41e50f5a8ef9f39537841450a72f42da9aab9']
2026-06-09T12:39:47.236067+0000 mgr.r03h01.nhzteq (mgr.43421861) 2382 : cephadm [INF] Upgrade: pre-pulling image quay.io/ceph/ceph@sha256:4940f3e4da8077b68e577c2dcbf313c7c2f9c3b61654c52fcb28884a6ef96a7b on 6 host(s), up to 3 in parallel
2026-06-09T12:39:47.632854+0000 mgr.r03h01.nhzteq (mgr.43421861) 2384 : cephadm [INF] Upgrade: pulling image quay.io/ceph/ceph@sha256:4940f3e4da8077b68e577c2dcbf313c7c2f9c3b61654c52fcb28884a6ef96a7b on host r01h01
2026-06-09T12:39:47.641414+0000 mgr.r03h01.nhzteq (mgr.43421861) 2385 : cephadm [INF] Upgrade: pulling image quay.io/ceph/ceph@sha256:4940f3e4da8077b68e577c2dcbf313c7c2f9c3b61654c52fcb28884a6ef96a7b on host r01h02
2026-06-09T12:39:48.047564+0000 mgr.r03h01.nhzteq (mgr.43421861) 2386 : cephadm [INF] Upgrade: image already present on host r02h01 (1/6 done)
2026-06-09T12:39:48.837299+0000 mgr.r03h01.nhzteq (mgr.43421861) 2387 : cephadm [INF] Upgrade: image already present on host r02h02 (2/6 done)
2026-06-09T12:39:49.234088+0000 mgr.r03h01.nhzteq (mgr.43421861) 2388 : cephadm [INF] Upgrade: pulling image quay.io/ceph/ceph@sha256:4940f3e4da8077b68e577c2dcbf313c7c2f9c3b61654c52fcb28884a6ef96a7b on host r03h01
2026-06-09T12:40:13.641534+0000 mgr.r03h01.nhzteq (mgr.43421861) 2402 : cephadm [ERR] Upgrade: failed to pull image on host r01h01 (3/6 done)
2026-06-09T12:40:14.491361+0000 mgr.r03h01.nhzteq (mgr.43421861) 2403 : cephadm [INF] Upgrade: image already present on host r03h02 (4/6 done)
2026-06-09T12:40:14.654432+0000 mgr.r03h01.nhzteq (mgr.43421861) 2405 : cephadm [INF] Upgrade: pulled image on host r01h02 (5/6 done)
2026-06-09T12:40:15.400949+0000 mgr.r03h01.nhzteq (mgr.43421861) 2406 : cephadm [INF] Upgrade: pulled image on host r03h01 (6/6 done)
2026-06-09T12:40:15.401381+0000 mgr.r03h01.nhzteq (mgr.43421861) 2407 : cephadm [ERR] Upgrade: Paused due to UPGRADE_FAILED_PULL: Upgrade: failed to pre-pull target image on 1 host(s)
2026-06-09T12:40:43.417618+0000 mgr.r03h01.nhzteq (mgr.43421861) 2409 : cephadm [INF] Upgrade: Stopped

@kshtsk

kshtsk commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

ok to test

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

Nice. I wonder though about limiting pulls when performing a staggered upgrade. One could make an argument for pulling to all hosts regardless.

@FredNass

FredNass commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor Author

That would be easy to do: we would just replace pre_pull_hosts with the list of all hosts in the cluster when upgrade_pre_pull_all_hosts is true.

I'm not fully convinced, though, since:

  • we would then have to handle (and skip) pre-pull errors on hosts outside the upgrade scope, so that the upgrade can still proceed (with another upgrade_pre_pull_best_effort_outside_scope setting?)
  • upgrade_pre_pull_all_hosts is a persistent setting, an admin could forget it's enabled and, while scoping an upgrade to (say) only the RGWs, unintentionally pull the image on all hosts.

I suggest we skip that for now and open another PR if we want to introduce this feature.

@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

FredNass added 2 commits June 25, 2026 17:06
…rade

On clusters with many hosts and/or a large container image, cephadm's
on-demand image pulls (one per host, just before the first daemon on that host
is upgraded) are performed serially as the upgrade progresses and add up to a
significant share of the total upgrade time.

This is especially harmful when upgrading MDS daemons. The MDS upgrade fails
(or scales down) the filesystem first, and only then redeploys its MDS, which
pulls the target image on the host as part of the redeployment. The image
download therefore happens while the filesystem is already offline, so the pull
time is counted directly against filesystem unavailability and is felt by CephFS
clients. Pulling a large image on a host that does not yet have it can take a
while, needlessly extending the outage.

Add an optional phase that, before any daemon is upgraded (and before any
filesystem is failed), pulls the target image in parallel on every host in the
upgrade scope, capped by upgrade_max_parallel_image_pulls (default 8) to avoid
overwhelming the registry. The subsequent per-daemon pull then becomes a no-op,
so MDS redeployment no longer waits on an image download while the filesystem is
down. Hosts that already have the target image are skipped, and each pull is
logged per host with progress. When the upgrade is scoped
(--hosts/--services/--daemon-types), only hosts with a daemon in scope are
pre-pulled. If the image cannot be pulled on any host, the upgrade is paused
before any daemon is touched and the failing host(s) and reason are surfaced in
the cluster status, so no daemon is left down while the issue (often a full
disk) is resolved.

Disabled by default; enable with the mgr/cephadm/upgrade_pre_pull_images option.

Signed-off-by: Frédéric Nass <[email protected]>
@FredNass
FredNass force-pushed the wip-cephadm-upgrade-pre-pull branch from 10f5a31 to dbc860c Compare June 25, 2026 15:07
@kginonredhat

Copy link
Copy Markdown
Contributor

Closing the pull request hence based on this one created an improved pulling
See
#70314

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.

5 participants