Skip to content

Commit

Permalink
feat(NodeAllocator): Specify Docker host
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcadden committed Nov 29, 2017
1 parent 5bf2d88 commit 0cdf0a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/hosted/NodeAllocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ std::string ebbrt::NodeAllocator::RunCmd(std::string cmd) {
ebbrt::NodeAllocator::DockerContainer::~DockerContainer() {
if (!cid_.empty()) {
std::cerr << "removing container: " << cid_.substr(0, 12) << std::endl;
RunCmd("docker stop " + cid_);
RunCmd("docker rm -f " + cid_);
RunCmd(base_+" stop " + cid_);
RunCmd(base_+" rm -f " + cid_);
}
}

std::string ebbrt::NodeAllocator::DockerContainer::GetIp() {
auto cip = RunCmd("docker inspect -f '{{range "
auto cip = RunCmd(base_+" inspect -f '{{range "
".NetworkSettings.Networks}}{{.IPAddress}}{{end}}' " +
cid_ );
assert(cip != "");
Expand All @@ -100,13 +100,13 @@ std::string ebbrt::NodeAllocator::DockerContainer::Start() {
std::cerr << "| host:" << host_ << std::endl;
}
std::cerr << "| cid: " << cid_.substr(0, 12) << std::endl;
std::cerr << "| log: docker logs " << cid_.substr(0, 12) << std::endl;
std::cerr << "| log: " << base_ << " logs " << cid_.substr(0, 12) << std::endl;
return cid_;
}

std::string ebbrt::NodeAllocator::DockerContainer::StdOut() {
ebbrt::kbugon(cid_.empty());
return RunCmd("docker logs " + cid_);
return RunCmd(base_+" logs " + cid_);
}

ebbrt::NodeAllocator::Session::Session(bai::tcp::socket socket,
Expand Down Expand Up @@ -307,7 +307,6 @@ ebbrt::NodeAllocator::AllocateNode(std::string binary_path,
RunCmd("scp -q -o UserKnownHostsFile=/dev/null -o "
"StrictHostKeyChecking=no " +
binary_path + " root@" + cip + ":/root/img.elf");
/* kick start vm */
RunCmd("ssh -q -o UserKnownHostsFile=/dev/null -o "
"StrictHostKeyChecking=no root@"+cip+" 'touch /tmp/signal'");

Expand Down
1 change: 1 addition & 0 deletions src/hosted/PoolAllocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void ebbrt::PoolAllocator::AllocateNode(int i) {
std::string node = (specified_nodes) ? nodes_[i % nodes_.size()]
: std::string();

args.constraint_node = node;
auto nd = ebbrt::node_allocator->AllocateNode(binary_path_, args);

nd.NetworkId().Then(
Expand Down

0 comments on commit 0cdf0a4

Please # to comment.