Skip to content

Commit

Permalink
qa: test mgr cephfs mount blacklist
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
batrick committed Dec 4, 2019
1 parent df507cd commit 98e3b7e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions qa/tasks/cephfs/cephfs_test_case.py
Expand Up @@ -228,6 +228,15 @@ def get_session(self, client_id, session_ls=None):
def _session_by_id(self, session_ls):
return dict([(s['id'], s) for s in session_ls])

def wait_until_evicted(self, client_id, timeout=30):
def helper():
ls = self._session_list()
for s in ls:
if s['id'] == client_id:
return False
return True
self.wait_until_true(lambda: helper(), timeout)

def wait_for_daemon_start(self, daemon_ids=None):
"""
Wait until all the daemons appear in the FSMap, either assigned
Expand Down
17 changes: 17 additions & 0 deletions qa/tasks/cephfs/test_volumes.py
Expand Up @@ -1073,3 +1073,20 @@ def test_async_subvolume_rm(self):

# verify trash dir is clean
self._wait_for_trash_empty()

def test_mgr_eviction(self):
# unmount any cephfs mounts
self.mount_a.umount_wait()
sessions = self._session_list()
self.assertLessEqual(len(sessions), 1) # maybe mgr is already mounted

# Get the mgr to definitely mount cephfs
subvolume = self._generate_random_subvolume_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'])

0 comments on commit 98e3b7e

Please sign in to comment.