diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-03-16 20:21:59 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-03-26 20:00:31 +0300 |
commit | 2af2c4f092aa7efffe839ec615c06d22cf43cc3b (patch) | |
tree | e84676dbf273602fdf1f3541171df9dad7060daf /bbot/agent/machine.cxx | |
parent | 392c6003321047421467e07eac31e12875377ead (diff) |
Add support for interactive builds
Diffstat (limited to 'bbot/agent/machine.cxx')
-rw-r--r-- | bbot/agent/machine.cxx | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx index c884f8c..3768971 100644 --- a/bbot/agent/machine.cxx +++ b/bbot/agent/machine.cxx @@ -171,7 +171,8 @@ namespace bbot const machine_manifest&, const optional<string>& mac, const string& br_iface, - uint16_t tftp_port); + uint16_t tftp_port, + bool pub_vnc); virtual bool shutdown (size_t& seconds) override; @@ -214,18 +215,14 @@ namespace bbot const machine_manifest& mm, const optional<string>& omac, const string& br, - uint16_t port) + uint16_t port, + bool pub_vnc) : machine (mm.mac ? *mm.mac : // Fixed mac from machine manifest. omac ? *omac : // Generated mac from previous bootstrap. generate_mac ()), kvm ("kvm"), net (br, port), - // - // QEMU's -vnc option (see below) expects the port offset from 5900 - // rather than the absolute value. The low 5901+, 6001+, and 6101+ - // ports all look good collision-wise with anything useful. - // - vnc ("127.0.0.1:" + to_string (5900 + offset)), + vnc (machine_vnc (pub_vnc)), monitor ("/tmp/monitor-" + tc_name + '-' + to_string (inst)) { tracer trace ("kvm_machine", md.string ().c_str ()); @@ -402,7 +399,15 @@ namespace bbot // VNC. // - "-vnc", "127.0.0.1:" + to_string (offset), // 5900 + offset + // We listen on all IPs for a public VNC session and only on localhost + // for private. + // + // QEMU's -vnc option expects the port offset from 5900 rather than the + // absolute value. The low 5901+, 6001+, and 6101+ ports all look good + // collision-wise with anything useful. + // + "-vnc", + (pub_vnc ? ":" : "127.0.0.1:") + to_string (offset), // 5900 + offset // QMP. // @@ -636,16 +641,28 @@ namespace bbot const machine_manifest& mm, const optional<string>& mac, const string& br_iface, - uint16_t tftp_port) + uint16_t tftp_port, + bool pub_vnc) { switch (mm.type) { case machine_type::kvm: - return make_unique<kvm_machine> (md, mm, mac, br_iface, tftp_port); + return make_unique<kvm_machine> ( + md, mm, mac, br_iface, tftp_port, pub_vnc); + case machine_type::nspawn: assert (false); //@@ TODO } return nullptr; } + + string + machine_vnc (bool pub) + { + string r (pub ? hip : "127.0.0.1"); + r += ':'; + r += to_string (5900 + offset); + return r; + } } |