From: Ramana Raja Date: Wed, 13 Apr 2016 08:33:51 +0000 (+0530) Subject: ceph_volume_client: evict client also based on mount path X-Git-Tag: v10.2.2~39^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=470605c38f772e5bcc466e71ac232294b41be276;p=ceph.git ceph_volume_client: evict client also based on mount path Evict clients based on not just their auth ID, but also based on the volume path mounted. This is needed for the Manila use-case, where the clients using an auth ID are denied further access to a share. Fixes: http://tracker.ceph.com/issues/15855 Signed-off-by: Ramana Raja (cherry picked from commit 68714b9dda8ed6010cad6730e0ddf54b3219150d) (cherry picked from commit aaa0e9aea9fcf2f63e73e544bd40c10a0d694408) --- diff --git a/src/pybind/ceph_volume_client.py b/src/pybind/ceph_volume_client.py index 16d32476f50..bb75e3477be 100644 --- a/src/pybind/ceph_volume_client.py +++ b/src/pybind/ceph_volume_client.py @@ -215,16 +215,22 @@ class CephFSVolumeClient(object): self.cluster_name = cluster_name self.auth_id = auth_id - def evict(self, auth_id, timeout=30): + def evict(self, auth_id, timeout=30, volume_path=None): """ - Evict all clients using this authorization ID. Assumes that the - authorisation key has been revoked prior to calling this function. + Evict all clients based on the authorization ID and optionally based on + the volume path mounted. Assumes that the authorization key has been + revoked prior to calling this function. This operation can throw an exception if the mon cluster is unresponsive, or any individual MDS daemon is unresponsive for longer than the timeout passed in. """ - log.info("evict: {0}".format(auth_id)) + client_spec = ["auth_name={0}".format(auth_id), ] + if volume_path: + client_spec.append("client_metadata.root={0}". + format(self._get_path(volume_path))) + + log.info("evict clients with {0}".format(', '.join(client_spec))) mds_map = self._rados_command("mds dump", {}) @@ -239,7 +245,8 @@ class CephFSVolumeClient(object): # the latter doesn't give us per-mds output threads = [] for rank, gid in up.items(): - thread = RankEvicter(self, ["auth_name={0}".format(auth_id)], rank, gid, mds_map, timeout) + thread = RankEvicter(self, client_spec, rank, gid, mds_map, + timeout) thread.start() threads.append(thread) @@ -250,9 +257,9 @@ class CephFSVolumeClient(object): for t in threads: if not t.success: - msg = "Failed to evict client {0} from mds {1}/{2}: {3}".format( - auth_id, t.rank, t.gid, t.exception - ) + msg = ("Failed to evict client with {0} from mds {1}/{2}: {3}". + format(', '.join(client_spec), t.rank, t.gid, t.exception) + ) log.error(msg) raise EvictionError(msg)