diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-03-26 08:02:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-03-26 08:02:49 +0200 |
commit | 6fbb94e01784b72821e976e000fe6d82bedabb66 (patch) | |
tree | 1bbef71793008d219a185102ec33b8dc79f25901 | |
parent | 997fef310ebf496205e101be0d95db5d0452e5ac (diff) |
Fix bug in default_ram_minimum value in bbot-agent
-rw-r--r-- | bbot/agent/agent.cxx | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx index 5e7ba65..2de1d8b 100644 --- a/bbot/agent/agent.cxx +++ b/bbot/agent/agent.cxx @@ -60,7 +60,7 @@ using std::endl; // plausible like 256MiB. This way we won't end up with degenerate cases where // we attempt to start a machine with some absurd amount of RAM. // -const std::uint64_t default_ram_minimum = 252144; +const std::uint64_t default_ram_minimum = 262144; static inline std::uint64_t effective_ram_minimum (const machine_header_manifest& m) @@ -444,7 +444,7 @@ bootstrap_build_machine (const dir_path& md, // the machine directory and ignore the machine for now). // static vector<size_t> -divide_auxiliary_ram (const vector<const machine_manifest*>&); +divide_auxiliary_ram (const vector<const machine_header_manifest*>&); static optional<bootstrapped_machine_manifest> bootstrap_auxiliary_machine (const dir_path& md, @@ -1796,7 +1796,7 @@ catch (const system_error& e) // insufficient. // static vector<size_t> // Parallel to mms. -divide_auxiliary_ram (const vector<const machine_manifest*>& mms) +divide_auxiliary_ram (const vector<const machine_header_manifest*>& mms) { size_t ram (ops.auxiliary_ram ()); @@ -1805,7 +1805,7 @@ divide_auxiliary_ram (const vector<const machine_manifest*>& mms) // First pass: allocate the minimums. // - for (const machine_manifest* mm: mms) + for (const machine_header_manifest* mm: mms) { size_t v (effective_ram_minimum (*mm)); @@ -1855,7 +1855,7 @@ divide_auxiliary_ram (const vector<const machine_manifest*>& mms) { if (rnds[i] != a) { - const machine_manifest& mm (*mms[i]); + const machine_header_manifest& mm (*mms[i]); size_t o (rams[i]); size_t v (effective_ram_minimum (mm)); @@ -1961,7 +1961,7 @@ start_auxiliary_machines (const vector<bootstrapped_machine*>& ams, // vector<size_t> rams; { - vector<const machine_manifest*> mms; + vector<const machine_header_manifest*> mms; mms.reserve (n); for (bootstrapped_machine* am: ams) mms.push_back (&am->manifest.machine); @@ -2522,6 +2522,21 @@ try verb = ops.verbose (); +#if 0 + // ./bbot-agent --auxiliary-ram 4194304 + // + machine_header_manifest m1 { + "m1", "m1", "m1", machine_role::auxiliary, 512*1024, nullopt}; + machine_header_manifest m2 { + "m2", "m2", "m2", machine_role::auxiliary, 1024*1024, 3*512*1024}; + vector<const machine_header_manifest*> mms {&m1, &m2}; + vector<size_t> rams (divide_auxiliary_ram (mms)); + for (size_t i (0); i != rams.size (); ++i) + text << mms[i]->name << ' ' << rams[i] / 1024; + + return 0; +#endif + // @@ systemd 231 added JOURNAL_STREAM environment variable which allows // detecting if stderr is connected to the journal. // |