From 92c05da96ae272f2652cbdf993ffea575b323bb0 Mon Sep 17 00:00:00 2001 From: Firmlyzhu Date: Wed, 8 Aug 2018 21:32:37 +0800 Subject: [PATCH] add token to lxcname --- src/worker/taskcontroller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/worker/taskcontroller.py b/src/worker/taskcontroller.py index 9b1ca68..bebe6d8 100755 --- a/src/worker/taskcontroller.py +++ b/src/worker/taskcontroller.py @@ -122,14 +122,14 @@ class TaskController(rpc_pb2_grpc.WorkerServicer): image['type'] = 'base' image['owner'] = request.cluster.image.owner username = request.username - lxcname = '%s-batch-%s-%s' % (username,taskid,str(instanceid)) + token = request.token + lxcname = '%s-batch-%s-%s-%s' % (username,taskid,str(instanceid),token) instance_type = request.cluster.instance outpath = [request.parameters.stdoutRedirectPath,request.parameters.stderrRedirectPath] for i in range(len(outpath)): if outpath[i] == "": outpath[i] = "/root/nfs/" timeout = request.timeout - token = request.token # acquire ip [status, ip] = self.acquire_ip() @@ -146,7 +146,7 @@ class TaskController(rpc_pb2_grpc.WorkerServicer): if not os.path.isdir("%s/global/users/%s" % (self.fspath,username)): path = env.getenv('DOCKLET_LIB') - subprocess.call([path+"/userinit.sh", username]) + subprocess.call([path+"/master/userinit.sh", username]) logger.info("user %s directory not found, create it" % username) sys_run("mkdir -p /var/lib/lxc/%s" % lxcname) logger.info("generate config file for %s" % lxcname)