Enhancement #77270
openOptionally pre-pull target image on all hosts before upgrade
0%
Description
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.
The purpose of this PR is to 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.
Opt-in via:ceph config set mgr mgr/cephadm/upgrade_pre_pull_images true
Parallelism (default 8) can be tuned via:ceph config set mgr mgr/cephadm/upgrade_max_parallel_image_pulls 8
Files
FN Updated by Frédéric NASS 6 months ago
- Pull request ID set to 69358
KG Updated by kobi ginon 5 months ago
- Assignee set to kobi ginon
Sounds interesting
investigating this one
KG Updated by kobi ginon 5 months ago · Edited
- File clipboard-202607092129-eafob.png clipboard-202607092129-eafob.png added
- File clipboard-202607092134-nwvxh.png clipboard-202607092134-nwvxh.png added
Paste this as the PR description replacement:
```markdown
- Summary
Opt-in upgrade image pre-distribution before any daemon is upgraded.
Today, cephadm pulls the target Ceph container image on each host on demand during upgrade. On large clusters / large images this adds significant time (and for MDS can extend CephFS unavailability after `fs fail` / scale-down).
This PR adds a single config option to pre-distribute that image to in-scope hosts before daemon upgrades:
| `mgr/cephadm/upgrade_image_mirror_method` | Behavior |
| --- | --- |
| `''` / `none` (default) | Disabled (current behavior) |
| `registry` | Parallel `podman`/`docker` pull on all in-scope hosts from a reachable registry (Harbor/Quay/local registry). Digests/version learned from those pulls (no serial first pull). |
| `local_http` | Pull once on a seed host, `save` → gzip tar, short-lived HTTP server (default TCP 8766), parallel load on workers over the cluster LAN. For telco / air-gap where only admin/mgr hosts reach the registry. |
Also:
- Persist `image_mirror_done` in upgrade state (survives mgr failover)
- Pause with `UPGRADE_FAILED_PULL` if pre-distribution fails (no daemons upgraded yet)
- Retag workers after `local_http` load so `image:tag` is preserved (not only IMAGE ID with `<none>` tag)
- Docs: `doc/cephadm/upgrade.rst` + port note in `doc/rados/configuration/network-config-ref.rst`
Skectch
Scope: applies to the Ceph upgrade target image only (`ceph orch upgrade start --image …`). Monitoring stack images (Grafana/Prometheus/…) and SMB/NVMeoF images are separate (`NON_CEPH_IMAGE_TYPES`) and are not pre-distributed by this feature.
- Config
- enable parallel registry pre-pull
ceph config set mgr mgr/cephadm/upgrade_image_mirror_method registry
- OR enable HTTP mirror from seed
ceph config set mgr mgr/cephadm/upgrade_image_mirror_method local_http
- optional tuning
ceph config set mgr mgr/cephadm/upgrade_image_mirror_max_parallel 8
- local_http only (default 8766)
ceph config set mgr mgr/cephadm/upgrade_image_mirror_port 8766
- disable
ceph config set mgr mgr/cephadm/upgrade_image_mirror_method none
```
- Manual verification (kcli 3-node)
Environment: ceph-node-0/1/2, local registry `192.168.100.254:5000`, images `main1.0.kobi` → `main2.0.kobi` / `main3.0.kobi` (mgr code under test baked into the image).
Monitoring during upgrade:
- `watch n 2 'ceph orch upgrade status'` `journalctl u ceph<fsid>@mgr.<host>.* f` On each host: `podman images`
- For `local_http` on seed: `ss -lntp | grep 8766` (or custom port)
- Scenario A — `registry` (Harbor-like; all hosts can pull)
```bash
ceph config set mgr mgr/cephadm/upgrade_image_mirror_method registry
ceph config set mgr mgr/cephadm/upgrade_image_mirror_max_parallel 8
ceph orch upgrade start --image 192.168.100.254:5000/ceph/ceph:main2.0.kobi
```
Observed progression:
1. `"message": "Discovering and pre-pulling upgrade image on 3 host(s)"` — target image appears on all hosts before daemon upgrades
2. Then normal upgrade: mgr → … → osd (`2/11` … `9/11` …)
3. Finish: `There are no upgrades in progress currently.`
Hosts show the new tag/IMAGE ID present during/after the pre-pull phase (watch `podman images` on all three nodes).
- Scenario B — `local_http` (only seed/admin reaches registry)
```bash
ceph config set mgr mgr/cephadm/upgrade_image_mirror_method local_http
ceph config set mgr mgr/cephadm/upgrade_image_mirror_max_parallel 8
ceph orch upgrade start --image 192.168.100.254:5000/ceph/ceph:<target>
```
Observed progression:
1. `"Doing first pull of … image"` (learn digests/version)
2. `"Saving upgrade image on seed host ceph-node-0"`
3. Seed briefly listens: `ss -lntp | grep 8766` → `192.168.100.100:8766` (`python3`)
4. `"Mirroring upgrade image to ceph-node-N (k/2)"`
5. Then daemon upgrades (`Currently upgrading mgr daemons`, …)
6. Finish successfully
Port / parallelism override also verified:
```bash
ceph config set mgr mgr/cephadm/upgrade_image_mirror_method local_http
ceph config set mgr mgr/cephadm/upgrade_image_mirror_port 8788
ceph config set mgr mgr/cephadm/upgrade_image_mirror_max_parallel 1
```
With `max_parallel=1`, mirror messages advance one host at a time (`1/2` then `2/2`).
- Same-image start (no regression)
```bash
ceph orch upgrade start --image 192.168.100.254:5000/ceph/ceph:main2.0.kobi
```
When already on that image: upgrade identifies same image and aborts — no unwanted work.
- Unit / static checks (local)
- `tox e py3 - cephadm/tests/` → 1503 passed, 1 skipped
- `tox e flake8 - cephadm` → OK
- `tox e mypy - m cephadm` → OK `tox e jinjalint` → OK `src/cephadm` `tox -e py3` / `flake8` → OK
```
this feature only pre-distributes the Ceph upgrade target image (the one from `ceph orch upgrade start --image …`).
It does not cover Grafana / monitoring or SMB images.
| Daemon set | Image used | Covered by `upgrade_image_mirror_method`? |
| --- | --- | --- |
| mgr, mon, osd, mds, rgw, crash, … + iscsi/nfs | Ceph image | Yes |
| grafana, prometheus, alertmanager, loki, … | Separate monitoring images | No |
| smb, nvmeof | Separate images | No |
In code, monitoring + smb + nvmeof are `NON_CEPH_IMAGE_TYPES`. During upgrade they may be redeployed, but digest matching treats them as already on the “right” image relative to the Ceph target — they never pull/mirror that Ceph image for themselves.
So the demo answer is: this solves the large Ceph image pull before daemon upgrades; monitoring/SMB stay on their own image settings and are out of scope for this PR.
KG Updated by kobi ginon 5 months ago
sequenceDiagram
participant M as mgr/cephadm upgrade.py
participant S as seed host
participant H as in-scope hosts
M->>M: learn target digests (existing first pull)
M->>M: _mirror_upgrade_image_via_http() if enabled
S->>S: pull + podman save → tar
S->>S: python3 m http.server (cluster IP)
par max_parallel
H>>S: curl tar
H->>H: podman load
end
S->>S: stop server, remove tar
M->>M: image_mirror_done = true
M->>M: normal daemon upgrade loop (MDS prep after mirror)FN Updated by Frédéric NASS 5 months ago
@kobi ginon We might want to avoid NIC saturation on the seeding host, and cascading effects on Ceph services due to heartbeat timeouts, etc.
KG Updated by kobi ginon 5 months ago
- Pull request ID changed from 69358 to 70315
FN Updated by Frédéric NASS 5 months ago
- Pull request ID changed from 70315 to 70314
@kobi ginon After closing my initial PR (#69358), the PR reference on this tracker was accidentally set to 70315 instead of 70314. I'm updating it to 70314 now.
KG Updated by kobi ginon 4 months ago
- File clipboard-202608051103-wwuym.png clipboard-202608051103-wwuym.png added
- File clipboard-202608051104-gmhmq.png clipboard-202608051104-gmhmq.png added
the two options describe above
And related to grafana / smb / other monitoring images
