From d71838c3d7034022a6744363f32e78324e2d1bd2 Mon Sep 17 00:00:00 2001 From: zhongyehong Date: Thu, 12 Oct 2017 18:16:15 +0800 Subject: [PATCH] change the mode of tmp dir to 777,to fix a warning causing by apt. add some error message when start service failed. change the start_jupyter.sh, use `which jupyterhub-single` to get the position of jupyterhub-single --- src/container.py | 7 +++++-- src/imagemgr.py | 2 +- tools/docklet-deploy.sh | 4 ++-- tools/start_jupyter.sh | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/container.py b/src/container.py index 87c0d74..9f78861 100755 --- a/src/container.py +++ b/src/container.py @@ -185,11 +185,14 @@ IP=%s if Ret == 0: logger.info("start ssh and jupyter notebook services for container %s success" % lxc_name) return [True, "start container services success"] + else: + logger.error('start services for container %s failed:jupyter' % lxc_name) + return [False, "start services for container failed:jupyter"] else: logger.info("start ssh service for container %s success" % lxc_name) return [True, "start container services success"] - logger.error('start services for container %s failed' % lxc_name) - return [False, "start services for container failed"] + logger.error('start services for container %s failed:ssh' % lxc_name) + return [False, "start services for container failed:ssh"] # mount_container: mount base image and user image by aufs def mount_container(self,lxc_name): diff --git a/src/imagemgr.py b/src/imagemgr.py index a020bc1..291aa5d 100755 --- a/src/imagemgr.py +++ b/src/imagemgr.py @@ -155,7 +155,7 @@ class ImageMgr(): self.prepareImage(user,image,layer) logger.info("image has been prepared") sys_run("mount -t aufs -o br=%s=rw:%s/local/basefs=ro+wh -o udba=reval none %s/" % (layer,self.NFS_PREFIX,rootfs),True) - sys_run("mkdir -p %s/local/temp/%s" % (self.NFS_PREFIX,lxc)) + sys_run("mkdir -m 777 -p %s/local/temp/%s" % (self.NFS_PREFIX,lxc)) except Exception as e: logger.error(e) diff --git a/tools/docklet-deploy.sh b/tools/docklet-deploy.sh index 417873f..441d476 100755 --- a/tools/docklet-deploy.sh +++ b/tools/docklet-deploy.sh @@ -18,7 +18,7 @@ apt-get update echo "$MASTER_IP docklet-master" >> /etc/hosts #下载git包 -apt-get install git +apt-get -y install git #下载docklet源码 git clone http://github.com/unias/docklet.git /home/docklet @@ -42,7 +42,7 @@ cp /home/docklet/conf/docklet.conf.template /home/docklet/conf/docklet.conf NETWORK_DEVICE=`route | grep default | awk {'print $8'};` #更改配置文件 -echo "DISKPOOL_SIZE=100000 +echo "DISKPOOL_SIZE=10000 ETCD=$MASTER_IP:2379 NETWORK_DEVICE=$NETWORK_DEVICE PORTAL_URL=http://iwork.pku.edu.cn diff --git a/tools/start_jupyter.sh b/tools/start_jupyter.sh index 73a5976..dd45cc2 100755 --- a/tools/start_jupyter.sh +++ b/tools/start_jupyter.sh @@ -8,7 +8,7 @@ DAEMON_USER=root # settings for docklet worker -DAEMON=/usr/local/bin/jupyterhub-singleuser +DAEMON=`which jupyterhub-singleuser` DAEMON_NAME=jupyter # The process ID of the script when it runs is stored here: PIDFILE=/home/jupyter/$DAEMON_NAME.pid