Do not bind python2 specific directory into container
Use more generic path to place storlets python codes, so that we can use the same path for python2 and python3. Change-Id: Ia4ee0790ea58a42173f58bed2f59249c0b7edfd9
This commit is contained in:
parent
ade5040b82
commit
7ab7b1029f
@ -25,7 +25,7 @@
|
||||
# $3 is assumed to be the factory debug level, e.g. DEBUG
|
||||
|
||||
if [ $1 == "debug" ]; then
|
||||
$2
|
||||
$2
|
||||
else
|
||||
/usr/local/libexec/storlets/storlets-daemon-factory $2 $3 $HOSTNAME
|
||||
PYTHONPATH='/usr/local/lib/storlets/python' /usr/local/libexec/storlets/storlets-daemon-factory $2 $3 $HOSTNAME
|
||||
fi
|
||||
|
@ -28,3 +28,9 @@ chmod 755 $DST
|
||||
cp "$SRC/init_container.sh" $DST
|
||||
cp "$SRC/storlets-daemon" $DST
|
||||
cp "$SRC/storlets-daemon-factory" $DST
|
||||
|
||||
# Install python library to be mouted by containers
|
||||
DST=/usr/local/lib/storlets/python
|
||||
mkdir -p $DST
|
||||
chmod 755 $DST
|
||||
pip install . -t $DST --no-compile
|
||||
|
@ -39,9 +39,8 @@ int main(int argc, char **argv) {
|
||||
char mount_dir2[512];
|
||||
char mount_dir3[512];
|
||||
char mount_dir4[512];
|
||||
char mount_dir5[512];
|
||||
|
||||
if (argc != 8) {
|
||||
if (argc != 7) {
|
||||
fprintf(stderr, "Usage: %s container_name container_image mount_dir1 mount_dir2 mount_dir3 mount_dir4\n",
|
||||
argv[0]);
|
||||
return 1;
|
||||
@ -53,7 +52,6 @@ int main(int argc, char **argv) {
|
||||
snprintf(mount_dir2,(size_t)512, "%s", argv[4]);
|
||||
snprintf(mount_dir3,(size_t)512, "%s", argv[5]);
|
||||
snprintf(mount_dir4,(size_t)512, "%s", argv[6]);
|
||||
snprintf(mount_dir5,(size_t)512, "%s", argv[7]);
|
||||
|
||||
int ret;
|
||||
setresuid(0, 0, 0);
|
||||
@ -65,13 +63,12 @@ int main(int argc, char **argv) {
|
||||
ret = system(command);
|
||||
|
||||
sprintf(command,
|
||||
"/usr/bin/docker run --net=none --name %s -d -v /dev/log:/dev/log -v %s -v %s -v %s -v %s -v %s -i -t %s",
|
||||
"/usr/bin/docker run --net=none --name %s -d -v /dev/log:/dev/log -v %s -v %s -v %s -v %s -i -t %s",
|
||||
container_name,
|
||||
mount_dir1,
|
||||
mount_dir2,
|
||||
mount_dir3,
|
||||
mount_dir4,
|
||||
mount_dir5,
|
||||
container_image);
|
||||
ret = system(command);
|
||||
if(ret){
|
||||
|
@ -133,10 +133,6 @@ class RunTimePaths(object):
|
||||
conf.get('script_dir',
|
||||
os.path.join(self.host_root_dir, 'scripts'))
|
||||
|
||||
self.host_storlet_python_lib_dir = ('/usr/local/lib/python2.7/'
|
||||
'dist-packages/storlets')
|
||||
self.sandbox_storlet_python_lib_dir = ('/usr/local/lib/python2.7/'
|
||||
'dist-packages/storlets')
|
||||
self.host_storlet_native_lib_dir = '/usr/local/lib/storlets'
|
||||
self.sandbox_storlet_native_lib_dir = '/usr/local/lib/storlets'
|
||||
self.host_storlet_native_bin_dir = '/usr/local/libexec/storlets'
|
||||
@ -298,9 +294,6 @@ class RunTimeSandbox(object):
|
||||
self.paths.sandbox_pipe_dir)
|
||||
storlet_mount = '%s:%s:ro' % (self.paths.host_storlet_base_dir,
|
||||
self.paths.sandbox_storlet_base_dir)
|
||||
storlet_python_lib_mount = '%s:%s:ro' % (
|
||||
self.paths.host_storlet_python_lib_dir,
|
||||
self.paths.sandbox_storlet_python_lib_dir)
|
||||
storlet_native_lib_mount = '%s:%s:ro' % (
|
||||
self.paths.host_storlet_native_lib_dir,
|
||||
self.paths.sandbox_storlet_native_lib_dir)
|
||||
@ -311,8 +304,8 @@ class RunTimeSandbox(object):
|
||||
cmd = [os.path.join(self.paths.host_restart_script_dir,
|
||||
'restart_docker_container'),
|
||||
docker_container_name, docker_image_name, pipe_mount,
|
||||
storlet_mount, storlet_python_lib_mount,
|
||||
storlet_native_lib_mount, storlet_native_bin_mount]
|
||||
storlet_mount, storlet_native_lib_mount,
|
||||
storlet_native_bin_mount]
|
||||
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user