From 5b58e64b60410d3b763915faad484d569da26dea Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 28 Jan 2019 15:06:45 +0200 Subject: Add ability to specify alternative bridge interface to bbot-agent --- bbot/agent/agent.cli | 40 +++++++++++++++++++++++----------------- bbot/agent/agent.cxx | 17 ++++++++--------- bbot/bbot-agent@.service | 8 +++++--- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/bbot/agent/agent.cli b/bbot/agent/agent.cli index 89fa9ff..a7a5d4c 100644 --- a/bbot/agent/agent.cli +++ b/bbot/agent/agent.cli @@ -49,23 +49,6 @@ namespace bbot "Run as a simple systemd daemon." } - path --auth-key - { - "", - "Private key for the public key-based agent authentication. If not - specified, then the agent will not be able to request tasks from - controllers that require authentication. - - The file is expected to contain a single PEM-encoded private key - without a password. A suitable key can be generated using the - following command: - - \ - $ openssl genrsa 4096 >key.pem - \ - " - } - string --toolchain-name = "default" { "", @@ -120,6 +103,29 @@ namespace bbot "Amount of RAM (in kB) to use, 1G by default." } + string --bridge = "br1" + { + "", + "Bridge interface to use for machine networking, \cb{br1} by default." + }; + + path --auth-key + { + "", + "Private key for the public key-based agent authentication. If not + specified, then the agent will not be able to request tasks from + controllers that require authentication. + + The file is expected to contain a single PEM-encoded private key + without a password. A suitable key can be generated using the + following command: + + \ + $ openssl genrsa 4096 >key.pem + \ + " + } + strings --trust { "", diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx index eec6072..67d503d 100644 --- a/bbot/agent/agent.cxx +++ b/bbot/agent/agent.cxx @@ -139,8 +139,6 @@ bootstrap_machine (const dir_path& md, else try { - string br ("br1"); // Using private bridge for now. - // Start the TFTP server (server chroot is --tftp). Map: // // GET requests to .../toolchains//* @@ -178,7 +176,7 @@ bootstrap_machine (const dir_path& md, start_machine (md, mm, obmm ? obmm->machine.mac : nullopt, - br, + ops.bridge (), tftpd.port ())); { @@ -813,8 +811,6 @@ try // const dir_path xp (snapshot_path (md)); - string br ("br1"); // Using private bridge for now. - for (size_t retry (0);; ++retry) { if (retry != 0) @@ -836,7 +832,7 @@ try start_machine (xp, mm.machine, mm.machine.mac, - br, + ops.bridge (), tftpd.port ())); // Note: the machine handling logic is similar to bootstrap. @@ -1108,6 +1104,11 @@ try dr << info << "bbot agent " << BBOT_VERSION_ID; + dr << + info << "cpu(s) " << ops.cpu () << + info << "ram(kB) " << ops.ram () << + info << "bridge " << ops.bridge (); + if (fingerprint) dr << info << "auth key fp " << *fingerprint; @@ -1116,9 +1117,7 @@ try info << "toolchain num " << tc_num << info << "toolchain ver " << tc_ver.string () << info << "toolchain id " << tc_id << - info << "instance num " << inst << - info << "CPU(s) " << ops.cpu () << - info << "RAM(kB) " << ops.ram (); + info << "instance num " << inst; for (const string& u: controllers) dr << info << "controller url " << u; diff --git a/bbot/bbot-agent@.service b/bbot/bbot-agent@.service index 58f22a5..3f4cef3 100644 --- a/bbot/bbot-agent@.service +++ b/bbot/bbot-agent@.service @@ -13,10 +13,11 @@ Type=simple Environment=VERBOSE=3 -Environment=AUTH_KEY= - Environment=CPU=1 Environment=RAM=1048576 +Environment=BRIDGE=br1 + +Environment=AUTH_KEY= Environment=BOOTSTRAP_TIMEOUT=1200 Environment=BOOTSTRAP_RETRIES=2 @@ -41,9 +42,10 @@ Environment="CONTROLLER_TRUST=" ExecStart=/build/bots/default/bin/bbot-agent \ --systemd-daemon \ --verbose ${VERBOSE} \ - --auth-key ${AUTH_KEY} \ --cpu ${CPU} \ --ram ${RAM} \ + --bridge ${BRIDGE} \ + --auth-key ${AUTH_KEY} \ --bootstrap-timeout ${BOOTSTRAP_TIMEOUT} \ --bootstrap-retries ${BOOTSTRAP_RETRIES} \ --build-timeout ${BUILD_TIMEOUT} \ -- cgit v1.1