Skip to content

Commit

Permalink
Merge branch '83-leaked-mount-point' into 'main'
Browse files Browse the repository at this point in the history
Resolve "leaked mount point"

Closes #83

See merge request dependencies/oasis!86
  • Loading branch information
penglei0 committed Nov 16, 2024
2 parents c56ac04 + bc13062 commit 8bfd247
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/containernet/containernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def __init__(self, config: NestedConfig, yaml_base_path: str, oasis_workspace: s
self.start_time = time.time()
self.setUp()

def __check_leaked_mounts(self):
# check whether there are leaked mounts
cmd = "sudo mount | grep -i oasis | wc -l"
result = os.popen(cmd).read()
if int(result) > 0:
logging.warning("Error: there are leaked mounts. %s", result)
cmd = "sudo mount | grep -i 'oasis' | awk -F ' on | type ' '{print $2}' | xargs -I {} sudo umount \"{}\""
os.system(cmd)

def setUp(self) -> None:
logging.info(
"########################## Oasis setup "
Expand All @@ -78,6 +87,7 @@ def tearDown(self) -> None:

def stop(self):
self.tearDown()
self.__check_leaked_mounts()

def start(self):
# NestedContainernet, use case file name as the container name.
Expand Down

0 comments on commit 8bfd247

Please sign in to comment.