diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-10-05 11:12:17 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-10-05 11:12:17 +0300 |
commit | 21a34ead1ed194dda53c2c5ecb5075e8eb1652d7 (patch) | |
tree | 000bde9a90a1623cf3473d3ce6d0ef2dd8b13f98 | |
parent | 864b2ea9ff43307b2a616410d0607c63da0b6661 (diff) | |
download | ick-contractor-21a34ead1ed194dda53c2c5ecb5075e8eb1652d7.tar.gz |
fixes for ws handline
-rwxr-xr-x | contractor | 41 |
1 files changed, 22 insertions, 19 deletions
@@ -23,6 +23,10 @@ WS_SIZE = "20G" WS_MNT = "/mnt" +# The device on the worker for the workspace disk. +WORKER_WS_DEV = "vdb" + + # The worker VM image file on manager VM. WORKER_IMG = "worker.img" @@ -268,6 +272,14 @@ class GetGID(RemoteExecution): return ["id", "-g"] +class RemoveWS(RemoteExecution): + def msg(self): + return "remove workspace image on manager" + + def argv(self): + return ["rm", "-f", WS_IMG] + + class CreateWS(RemoteExecution): def msg(self): return "creating workspace on manager" @@ -297,7 +309,7 @@ class MountWSonWorker(RemoteExecution): return "mounting workspace on worker" def argv(self): - return ["sudo", "mount", "/dev/vdb", "/workspace"] + return ["sudo", "mount", "/dev/{}".format(WORKER_WS_DEV), "/workspace"] class TryUnmountWS(MayFail): @@ -398,7 +410,7 @@ class AttachWS(RemoteExecution): "attach-disk", "worker", WS_IMG, - "vdb", + WORKER_WS_DEV, "--targetbus", "virtio", "--live", @@ -649,23 +661,14 @@ def cmd_build(args): manager_gid = int(er.stdout) with Timer(vrb, "start-worker"): - execs = [TryUnmountWS()] - exec_quietly(manager, *execs) - - with Timer(vrb, "start-worker"): - execs = [CreateWS()] - exec_quietly(manager, *execs) - - with Timer(vrb, "start-worker"): - execs = [MkfsWS()] - exec_quietly(manager, *execs) - - with Timer(vrb, "start-worker"): - execs = [MountWS()] - exec_quietly(manager, *execs) - - with Timer(vrb, "start-worker"): - execs = [ChownWS(manager_uid, manager_gid)] + execs = [ + TryUnmountWS(), + RemoveWS(), + CreateWS(), + MkfsWS(), + MountWS(), + ChownWS(manager_uid, manager_gid), + ] exec_quietly(manager, *execs) with Timer(vrb, "upload-saved-workspace"): |