]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: don't mutate the cached osd_map in CephService 69317/head
authorKefu Chai <k.chai@proxmox.com>
Sun, 7 Jun 2026 08:58:20 +0000 (16:58 +0800)
committerKefu Chai <k.chai@proxmox.com>
Sun, 7 Jun 2026 12:07:09 +0000 (20:07 +0800)
commit4cbfb9d377b3bcf395e57bab7c122cf63f66018f
treec726bf4bde911a3b13bd51e547df5e84f085227e
parent561871e251af97afacc2b790d73ecfd297341c0f
mgr/dashboard: don't mutate the cached osd_map in CephService

test_pool_list fails intermittently:

  Traceback (most recent call last):
    File "qa/tasks/mgr/dashboard/test_pool.py", line 182, in test_pool_list
      self.assertNotIn('pg_status', pool)
  AssertionError: 'pg_status' unexpectedly found in
    {'pool': 1, 'pool_name': 'rbd', ..., 'pg_status': {'active+clean': 1}, ...}

mgr.get('osd_map') defaults to mutable=False, so cacheable_get_python()
returns the mgr's shared cached object rather than a copy.
get_pool_list_with_stats() writes pool['pg_status'] and pool['stats']
into those cached dicts, and get_erasure_code_profiles() sets ecp['name']
and rewrites ecp['k']/['m'] to int. The writes outlive the request, so
once a stats=true call has run, GET /api/pool with stats=false still
returns pools carrying pg_status and the assertion above fails. It only
triggers while the cache stays valid between the two requests, hence the
flakiness.

Audited the other dashboard readers of cached mgr.get() keys: these two
are the only sites that mutate the result; the rest only read, and
health.py already copies its osd_map before editing.

Copy the dicts before stamping them; the cache stays clean.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/pybind/mgr/dashboard/services/ceph_service.py