def _mountpoint_exists(self):
return self.client_remote.run(args=["ls", "-d", self.mountpoint], check_status=False, cwd=self.test_dir, timeout=(15*60)).exitstatus == 0
- def umount(self):
+ def umount(self, cleanup=True):
+ """
+ umount() must not run cleanup() when it's called by umount_wait()
+ since "run.wait([self.fuse_daemon], timeout)" would hang otherwise.
+ """
if not self.is_mounted():
+ if cleanup:
+ self.cleanup()
return
try:
self.id = None
self.inst = None
self.addr = None
+ if cleanup:
+ self.cleanup()
def umount_wait(self, force=False, require_clean=False, timeout=900):
"""
log.debug('ceph-fuse client.{id} is not mounted at {remote} {mnt}'.format(id=self.client_id,
remote=self.client_remote,
mnt=self.mountpoint))
+ self.cleanup()
return
if force:
# mount -o remount (especially if the remount is stuck because MDSs
# are unavailable)
- self.umount()
+ # cleanup is set to to fail since clieanup must happen after umount is
+ # complete; otherwise following call to run.wait hangs.
+ self.umount(cleanup=False)
try:
# Permit a timeout, so that we do not block forever
if require_clean:
raise
- self.cleanup_netns()
self.mounted = False
self.cleanup()
except CommandFailedError:
pass
- self.cleanup_netns()
self.mounted = False
# Indiscriminate, unlike the touchier cleanup()
def umount(self, force=False):
if not self.is_mounted():
+ self.cleanup()
return
log.debug('Unmounting client client.{id}...'.format(id=self.client_id))
raise e
self.mounted = False
- self.cleanup_netns()
self.cleanup()
def umount_wait(self, force=False, require_clean=False, timeout=900):
Unlike the fuse client, the kernel client's umount is immediate
"""
if not self.is_mounted():
+ self.cleanup()
return
try:
raise
# force delete the netns and umount
- self.cleanup_netns()
self.client_remote.run(
args=['sudo',
'umount',
timeout=(15*60))
self.mounted = False
- self.cleanup_netns()
self.cleanup()
def wait_until_mounted(self):
"""
log.info('Cleaning up killed connection on {0}'.format(self.client_remote.name))
self.umount_wait(force=True)
- self.cleanup()
def cleanup(self):
"""
else:
raise
+ self.cleanup_netns()
+
def wait_until_mounted(self):
raise NotImplementedError()