From ee7a77643e460b2ca13662c5ec429b5315310eab Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 7 Jan 2020 14:37:51 +0100 Subject: [PATCH] depot_deploy: support affinity configuration Fixes #3597 --- repos/gems/src/app/depot_deploy/child.h | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/repos/gems/src/app/depot_deploy/child.h b/repos/gems/src/app/depot_deploy/child.h index d542dbb5c..8a1064af6 100644 --- a/repos/gems/src/app/depot_deploy/child.h +++ b/repos/gems/src/app/depot_deploy/child.h @@ -368,6 +368,36 @@ void Depot_deploy::Child::gen_start_node(Xml_generator &xml, Xml_node common, xml.attribute("quantum", cpu_quota); }); + /* location handling */ + bool const affinity_from_launcher = _defined_by_launcher() + && (_launcher_xml->xml().has_attribute("xpos") || + _launcher_xml->xml().has_attribute("ypos")); + bool const affinity_from_start = _start_xml->xml().has_attribute("xpos") + || _start_xml->xml().has_attribute("ypos"); + if (affinity_from_start || affinity_from_launcher) { + long xpos = 0, ypos = 0; + unsigned width = 1, height = 1; + + if (affinity_from_launcher) { + xpos = _launcher_xml->xml().attribute_value("xpos", xpos); + ypos = _launcher_xml->xml().attribute_value("ypos", ypos); + width = _launcher_xml->xml().attribute_value("width", width); + height = _launcher_xml->xml().attribute_value("height", height); + } + xpos = _start_xml->xml().attribute_value("xpos", xpos); + ypos = _start_xml->xml().attribute_value("ypos", ypos); + width = _start_xml->xml().attribute_value("width", width); + height = _start_xml->xml().attribute_value("height", height); + + xml.node("affinity", [&] () { + xml.attribute("xpos", xpos); + xml.attribute("ypos", ypos); + xml.attribute("width", width); + xml.attribute("height", height); + }); + } + + /* runtime handling */ Xml_node const runtime = _pkg_xml->xml().sub_node("runtime"); /*