From 86b4231a64568f998796ddef856abb3b63f79f9f Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 10 Feb 2016 12:21:16 +0000 Subject: [PATCH] tasks/cephfs: run ceph-fuse in foreground Previously was running this in background, which prevented checking for nonzero exit codes. Signed-off-by: John Spray --- tasks/cephfs/vstart_runner.py | 69 +++-------------------------------- 1 file changed, 6 insertions(+), 63 deletions(-) diff --git a/tasks/cephfs/vstart_runner.py b/tasks/cephfs/vstart_runner.py index b8ab079d41fec..34a567d215b07 100644 --- a/tasks/cephfs/vstart_runner.py +++ b/tasks/cephfs/vstart_runner.py @@ -307,65 +307,9 @@ def safe_kill(pid): raise -class MountDaemon(object): - """ - Impersonate the fuse_daemon member of FuseMount - """ - - def __init__(self, client_id): - self.controller = LocalRemote() - self.client_id = client_id - - def _get_pid(self): - """ - Return PID as an integer or None if not found - """ - ps_txt = self.controller.run( - args=["ps", "uaww", "-C", "ceph-fuse"], - check_status=False # ps returns err if nothing running so ignore - ).stdout.getvalue().strip() - lines = ps_txt.split("\n")[1:] - - for line in lines: - if line.find("--name client.{0} ".format(self.client_id)) != -1: - return int(line.split()[1]) - - return None - - def poll(self): - return self._get_pid() is None - - @property - def finished(self): - return self._get_pid() is None - - def wait(self): - while self._get_pid() is not None: - time.sleep(1) - - def kill(self): - pid = self._get_pid() - if pid is None: - return - else: - safe_kill(pid) - - @property - def stdin(self): - class FakeStdIn(object): - def __init__(self, mount_daemon): - self.mount_daemon = mount_daemon - - def close(self): - self.mount_daemon.kill() - - return FakeStdIn(self) - - class LocalFuseMount(FuseMount): def __init__(self, test_dir, client_id): super(LocalFuseMount, self).__init__(None, test_dir, client_id, LocalRemote()) - self._proc = None @property def config_path(self): @@ -396,8 +340,8 @@ class LocalFuseMount(FuseMount): # the PID of the launching process, not the long running ceph-fuse process. Therefore # we need to give an exact path here as the logic for checking /proc/ for which # asok is alive does not work. - path = "./out/client.{0}.{1}.asok".format(self.client_id, self._proc.subproc.pid) - log.info("I think my launching pid was {0}".format(self._proc.subproc.pid)) + path = "./out/client.{0}.{1}.asok".format(self.client_id, self.fuse_daemon.subproc.pid) + log.info("I think my launching pid was {0}".format(self.fuse_daemon.subproc.pid)) return path def umount(self): @@ -444,16 +388,15 @@ class LocalFuseMount(FuseMount): if mount_path is not None: prefix += ["--client_mountpoint={0}".format(mount_path)] - self._proc = self.client_remote.run(args= + self.fuse_daemon = self.client_remote.run(args= prefix + [ + "-f", "--name", "client.{0}".format(self.client_id), self.mountpoint - ]) - - log.info("Mounted client.{0} with pid {1}".format(self.client_id, self._proc.subproc.pid)) + ], wait=False) - self.fuse_daemon = MountDaemon(self.client_id) + log.info("Mounted client.{0} with pid {1}".format(self.client_id, self.fuse_daemon.subproc.pid)) # Wait for the connection reference to appear in /sys waited = 0 -- 2.39.5