depot_deploy: support cpu quota configuration

the same as the ram and cap quota
This commit is contained in:
Alexander Boettcher 2019-11-08 14:49:02 +01:00 committed by Christian Helmuth
parent 5f350adb57
commit b2a7ac2996

View File

@ -97,6 +97,7 @@ class Depot_deploy::Child : public List_model<Child>::Element
*/ */
Number_of_bytes _pkg_ram_quota { 0 }; Number_of_bytes _pkg_ram_quota { 0 };
unsigned long _pkg_cap_quota { 0 }; unsigned long _pkg_cap_quota { 0 };
unsigned long _pkg_cpu_quota { 0 };
Binary_name _binary_name { }; Binary_name _binary_name { };
Config_name _config_name { }; Config_name _config_name { };
@ -181,6 +182,7 @@ class Depot_deploy::Child : public List_model<Child>::Element
_pkg_ram_quota = runtime.attribute_value("ram", Number_of_bytes()); _pkg_ram_quota = runtime.attribute_value("ram", Number_of_bytes());
_pkg_cap_quota = runtime.attribute_value("caps", 0UL); _pkg_cap_quota = runtime.attribute_value("caps", 0UL);
_pkg_cpu_quota = runtime.attribute_value("cpu", 0UL);
_binary_name = runtime.attribute_value("binary", Binary_name()); _binary_name = runtime.attribute_value("binary", Binary_name());
_config_name = runtime.attribute_value("config", Config_name()); _config_name = runtime.attribute_value("config", Config_name());
@ -356,6 +358,16 @@ void Depot_deploy::Child::gen_start_node(Xml_generator &xml, Xml_node common,
xml.attribute("quantum", String<32>(ram)); xml.attribute("quantum", String<32>(ram));
}); });
unsigned long cpu_quota = _pkg_cpu_quota;
if (_defined_by_launcher())
cpu_quota = _launcher_xml->xml().attribute_value("cpu", cpu_quota);
cpu_quota = _start_xml->xml().attribute_value("cpu", cpu_quota);
xml.node("resource", [&] () {
xml.attribute("name", "CPU");
xml.attribute("quantum", cpu_quota);
});
Xml_node const runtime = _pkg_xml->xml().sub_node("runtime"); Xml_node const runtime = _pkg_xml->xml().sub_node("runtime");
/* /*