Skip to content

Commit 0cdf0a4

Browse files
committed
feat(NodeAllocator): Specify Docker host
1 parent 5bf2d88 commit 0cdf0a4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/hosted/NodeAllocator.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ std::string ebbrt::NodeAllocator::RunCmd(std::string cmd) {
7575
ebbrt::NodeAllocator::DockerContainer::~DockerContainer() {
7676
if (!cid_.empty()) {
7777
std::cerr << "removing container: " << cid_.substr(0, 12) << std::endl;
78-
RunCmd("docker stop " + cid_);
79-
RunCmd("docker rm -f " + cid_);
78+
RunCmd(base_+" stop " + cid_);
79+
RunCmd(base_+" rm -f " + cid_);
8080
}
8181
}
8282

8383
std::string ebbrt::NodeAllocator::DockerContainer::GetIp() {
84-
auto cip = RunCmd("docker inspect -f '{{range "
84+
auto cip = RunCmd(base_+" inspect -f '{{range "
8585
".NetworkSettings.Networks}}{{.IPAddress}}{{end}}' " +
8686
cid_ );
8787
assert(cip != "");
@@ -100,13 +100,13 @@ std::string ebbrt::NodeAllocator::DockerContainer::Start() {
100100
std::cerr << "| host:" << host_ << std::endl;
101101
}
102102
std::cerr << "| cid: " << cid_.substr(0, 12) << std::endl;
103-
std::cerr << "| log: docker logs " << cid_.substr(0, 12) << std::endl;
103+
std::cerr << "| log: " << base_ << " logs " << cid_.substr(0, 12) << std::endl;
104104
return cid_;
105105
}
106106

107107
std::string ebbrt::NodeAllocator::DockerContainer::StdOut() {
108108
ebbrt::kbugon(cid_.empty());
109-
return RunCmd("docker logs " + cid_);
109+
return RunCmd(base_+" logs " + cid_);
110110
}
111111

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

src/hosted/PoolAllocator.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void ebbrt::PoolAllocator::AllocateNode(int i) {
4646
std::string node = (specified_nodes) ? nodes_[i % nodes_.size()]
4747
: std::string();
4848

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

5152
nd.NetworkId().Then(

0 commit comments

Comments
 (0)