]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/fs.py
9 from tasks
.cephfs
.filesystem
import Filesystem
11 log
= logging
.getLogger(__name__
)
13 def clients_evicted(ctx
, config
):
15 Check clients are evicted, unmount (cleanup) if so.
20 assert isinstance(config
, dict), \
21 'task only accepts a dict for configuration'
23 clients
= config
.get('clients')
26 clients
= {("client."+client_id
): True for client_id
in ctx
.mounts
}
28 log
.info("clients is {}".format(str(clients
)))
35 for client
in clients
:
36 client_id
= re
.match("^client.([0-9]+)$", client
).groups(1)[0]
37 mounts
[client
] = ctx
.mounts
.get(client_id
)
39 for rank
in fs
.get_ranks(status
=status
):
40 ls
= fs
.rank_asok(['session', 'ls'], rank
=rank
['rank'], status
=status
)
42 for client
, evicted
in six
.viewitems(clients
):
43 mount
= mounts
.get(client
)
45 global_id
= mount
.get_global_id()
46 if session
['id'] == global_id
:
48 raise RuntimeError("client still has session: {}".format(str(session
)))
50 log
.info("client {} has a session with MDS {}.{}".format(client
, fs
.id, rank
['rank']))
51 has_session
.add(client
)
53 no_session
= set(clients
) - has_session
55 for client
, evicted
in six
.viewitems(clients
):
56 mount
= mounts
.get(client
)
59 log
.info("confirming client {} is blacklisted".format(client
))
60 assert mount
.is_blacklisted()
61 elif client
in no_session
:
62 log
.info("client {} should not be evicted but has no session with an MDS".format(client
))
63 mount
.is_blacklisted() # for debugging
66 raise RuntimeError("some clients which should not be evicted have no session with an MDS?")