Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #306 from taotaowill/master
Browse files Browse the repository at this point in the history
bug fix: check chroot switch on deploy and terminate process
  • Loading branch information
imotai committed Feb 15, 2016
2 parents f320131 + fc5e1a6 commit 45f2fe0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ thirdsrc
thirdparty
sandbox/*.log
galaxy

initd_cli
initd_cli_server
sandbox/data/
sandbox/work_dir/
test_agent
test_initd
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions sandbox/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
Expand Down
6 changes: 4 additions & 2 deletions src/agent/task_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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=");
Expand Down Expand Up @@ -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=");
Expand Down

0 comments on commit 45f2fe0

Please sign in to comment.