Skip to content

Commit

Permalink
Fix client mount in run_stratagem (whamcloud#2085)
Browse files Browse the repository at this point in the history
Ref: f10ba6b

Signed-off-by: Igor Pashev <pashev.igor@gmail.com>

Co-authored-by: Joe Grund <jgrund@whamcloud.io>
  • Loading branch information
2 people authored and beevans committed Aug 6, 2020
1 parent edea4f7 commit 1e1ec4b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions chroma_core/services/job_scheduler/job_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,36 @@ def run_stratagem(self, mdts, fs_id, stratagem_data):
run_stratagem_list.append(
{
"class_name": "AggregateStratagemResultsJob",
"args": {"depends_on_job_range": range(1, len(run_stratagem_list)), "fs_name": filesystem.name},
}
)

client_host = ManagedHost.objects.get(
Q(server_profile_id="stratagem_client") | Q(server_profile_id="stratagem_existing_client")
)
client_mount_exists = LustreClientMount.objects.filter(
host_id=client_host.id, filesystem=filesystem.name
).exists()

mountpoint = "/mnt/{}".format(filesystem.name)
if not client_mount_exists:
self._create_client_mount(client_host, filesystem.name, mountpoint)

client_mount = ObjectCache.get_one(
LustreClientMount, lambda mnt: mnt.host_id == client_host.id and mnt.filesystem == filesystem.name
)
client_mount.state = "unmounted"

if mountpoint not in client_mount.mountpoints:
client_mount.mountpoints.append(mountpoint)

client_mount.filesystem = filesystem.name
client_mount.save()
ObjectCache.update(client_mount)

run_stratagem_list.append(
{
"class_name": "MountLustreClientJob",
"args": {
"depends_on_job_range": range(len(run_stratagem_list) - len(mdts), len(run_stratagem_list)),
"fs_name": filesystem.name,
Expand Down

0 comments on commit 1e1ec4b

Please sign in to comment.