]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/fs.py
4b47e754bfa2460e81651685f065bb423dc0cd32
8 from tasks
.cephfs
.filesystem
import Filesystem
10 log
= logging
.getLogger(__name__
)
12 def clients_evicted(ctx
, config
):
14 Check clients are evicted, unmount (cleanup) if so.
19 assert isinstance(config
, dict), \
20 'task only accepts a dict for configuration'
22 clients
= config
.get('clients')
25 clients
= {("client."+client_id
): True for client_id
in ctx
.mounts
}
27 log
.info("clients is {}".format(str(clients
)))
34 for client
in clients
:
35 client_id
= re
.match("^client.([0-9]+)$", client
).groups(1)[0]
36 mounts
[client
] = ctx
.mounts
.get(client_id
)
38 for rank
in fs
.get_ranks(status
=status
):
39 ls
= fs
.rank_asok(['session', 'ls'], rank
=rank
['rank'], status
=status
)
41 for client
, evicted
in clients
.viewitems():
42 mount
= mounts
.get(client
)
44 global_id
= mount
.get_global_id()
45 if session
['id'] == global_id
:
47 raise RuntimeError("client still has session: {}".format(str(session
)))
49 log
.info("client {} has a session with MDS {}.{}".format(client
, fs
.id, rank
['rank']))
50 has_session
.add(client
)
52 no_session
= set(clients
) - has_session
54 for client
, evicted
in clients
.viewitems():
55 mount
= mounts
.get(client
)
58 log
.info("confirming client {} is blacklisted".format(client
))
59 assert mount
.is_blacklisted()
60 elif client
in no_session
:
61 log
.info("client {} should not be evicted but has no session with an MDS".format(client
))
62 mount
.is_blacklisted() # for debugging
65 raise RuntimeError("some clients which should not be evicted have no session with an MDS?")