From 84c0ed494e453ea0ea9e5a64914d0c8734538932 Mon Sep 17 00:00:00 2001 From: taotaowill Date: Mon, 15 Feb 2016 17:12:29 +0800 Subject: [PATCH 1/2] bug fix: check chroot switch on deploy and terminate process --- .gitignore | 7 ++++++- sandbox/sample.json | 8 +++++--- src/agent/task_manager.cc | 6 ++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f82316af..ad80a4cf 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,9 @@ thirdsrc thirdparty sandbox/*.log galaxy - +initd_cli +initd_cli_server +sandbox/data/ +sandbox/work_dir/ +test_agent +test_initd diff --git a/sandbox/sample.json b/sandbox/sample.json index c6a15053..e98d8464 100644 --- a/sandbox/sample.json +++ b/sandbox/sample.json @@ -11,17 +11,19 @@ "millicores": 1000, "memory": "2G", "ports": [8080], - "read_bytes_ps": "1M" + "read_bytes_ps": "1M", + "write_bytes_ps": "1M" }, "tasks":[ { "binary": "", "source_type": "kSourceTypeCommand", - "start_command": "dd if=/dev/cciss/c0d0p6 of=/dev/null", + "start_command": "dd if=/dev/sda of=/dev/null", "requirement": { "millicores": 500, "memory": "2G", - "read_bytes_ps": "1M" + "read_bytes_ps": "1M", + "write_bytes_ps": "1M" } } ] diff --git a/src/agent/task_manager.cc b/src/agent/task_manager.cc index 465de230..0f76c0bc 100755 --- a/src/agent/task_manager.cc +++ b/src/agent/task_manager.cc @@ -551,7 +551,8 @@ int TaskManager::TerminateTask(TaskInfo* task_info) { ExecuteResponse initd_response; initd_request.set_key(task_info->stop_process.key()); initd_request.set_commands(stop_command); - if (FLAGS_agent_namespace_isolation_switch) { + if (FLAGS_agent_namespace_isolation_switch + && task_info->desc.namespace_isolation()) { initd_request.set_chroot_path(task_info->task_chroot_path); std::string* chroot_path = initd_request.add_envs(); chroot_path->append("CHROOT_PATH="); @@ -704,7 +705,8 @@ int TaskManager::DeployTask(TaskInfo* task_info) { ExecuteResponse initd_response; initd_request.set_key(task_info->deploy_process.key()); initd_request.set_commands(deploy_command); - if (FLAGS_agent_namespace_isolation_switch) { + if (FLAGS_agent_namespace_isolation_switch + && task_info->desc.namespace_isolation()) { initd_request.set_chroot_path(task_info->task_chroot_path); std::string* chroot_path = initd_request.add_envs(); chroot_path->append("CHROOT_PATH="); From fc5e1a6bd243fe3b8c2106c23bcf4c671b9a9728 Mon Sep 17 00:00:00 2001 From: taotaowill Date: Mon, 15 Feb 2016 19:04:53 +0800 Subject: [PATCH 2/2] modify leveldb in build.sh --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index f02f5339..a3a8f766 100644 --- a/build.sh +++ b/build.sh @@ -190,11 +190,11 @@ then else # leveldb - git clone https://github.com/imotai/leveldb.git + git clone https://github.com/google/leveldb.git cd leveldb make -j8 >/dev/null cp -rf include/* ${DEPS_PREFIX}/include - cp libleveldb.a ${DEPS_PREFIX}/lib + cp out-static/libleveldb.a ${DEPS_PREFIX}/lib cd - fi