From 8db0c8a4cc4bd394151533f254c7e7cfa9dbc1ca Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 26 Feb 2026 14:49:56 -0500 Subject: [PATCH] qa: allow multiple mgr sessions during eviction test Fixes: https://tracker.ceph.com/issues/70580 Signed-off-by: Patrick Donnelly --- qa/tasks/cephfs/test_volumes.py | 38 ++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index 3bbd58ec99f8..4b85802780ea 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -10235,22 +10235,40 @@ class TestMisc(TestVolumesHelper): self.wait_until_evicted(sessions[0]['id'], timeout=90) def test_mgr_eviction(self): - # unmount any cephfs mounts + # unmount any cephfs mounts to start from a clean state for i in range(0, self.CLIENTS_REQUIRED): self.mounts[i].umount_wait() - sessions = self._session_list() - self.assertLessEqual(len(sessions), 1) # maybe mgr is already mounted - # Get the mgr to definitely mount cephfs + # Helper to get mgr-specific sessions (type 16) + def get_mgr_sessions(): + all_sessions = self._session_list() + mgr_sessions = [s for s in all_sessions if s.get('auth_name', {}).get('type') == 16] + return all_sessions, mgr_sessions + + # Ensure we start with only mgr sessions (if any) + all_s, mgr_s = get_mgr_sessions() + self.assertEqual(len(all_s), len(mgr_s), f"Non-mgr sessions found: {all_s}") + + # Trigger mgr activity to ensure sessions are active subvolume = self._gen_subvol_name() self._fs_cmd("subvolume", "create", self.volname, subvolume) - sessions = self._session_list() - self.assertEqual(len(sessions), 1) - # Now fail the mgr, check the session was evicted - mgr = self.mgr_cluster.get_active_id() - self.mgr_cluster.mgr_fail(mgr) - self.wait_until_evicted(sessions[0]['id']) + # Get updated session list and verify they are all mgr types + all_sessions, mgr_sessions = get_mgr_sessions() + self.assertGreaterEqual(len(mgr_sessions), 1) + self.assertEqual(len(all_sessions), len(mgr_sessions), + f"Unexpected session types found: {all_sessions}") + + # Store IDs for eviction check + mgr_session_ids = [s['id'] for s in mgr_sessions] + + # Fail the mgr + mgr_id = self.mgr_cluster.get_active_id() + self.mgr_cluster.mgr_fail(mgr_id) + + # Assert all identified mgr session IDs are evicted + for s_id in mgr_session_ids: + self.wait_until_evicted(s_id) def test_names_can_only_be_goodchars(self): """ -- 2.47.3