mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
depot_deploy: move affinity to <affinity> sub node
The initial implementation of the affinity configuration in "depot_deploy: support affinity configuration" added the affinity location attributes to the <start> node of the deploy config. This patch moves the information into a dedicated <affinity> sub node as done by the init configuration. So the context of the attributes 'xpos', 'ypos', 'width' and 'height' becomes clear. It also fixes a usability issue in Sculpt that occurred during testing: When configuring multiple components with custom affinities, the resources dialog of later components would wrongly display the state of earlier components instead of displaying the fresh (default) state. The resulting configuration would then not match the displayed information. This is fixed by resetting the dialog state. As another minor cosmetic change, the patch adds a line break in front of copied <config> or <heartbeat> nodes. Issue #3597
This commit is contained in:
parent
2eb8c5e21a
commit
0d61029d7e
@ -134,6 +134,7 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
|
||||
Xml_node const sub_node = from_node.sub_node(sub_node_type.string());
|
||||
sub_node.with_raw_node([&] (char const *start, size_t length) {
|
||||
xml.append("\n\t\t");
|
||||
xml.append(start, length); });
|
||||
}
|
||||
|
||||
@ -368,32 +369,29 @@ void Depot_deploy::Child::gen_start_node(Xml_generator &xml, Xml_node common,
|
||||
xml.attribute("quantum", cpu_quota);
|
||||
});
|
||||
|
||||
/* location handling */
|
||||
/* affinity-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;
|
||||
&& _launcher_xml->xml().has_sub_node("affinity");
|
||||
|
||||
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);
|
||||
bool const affinity_from_start = _start_xml->xml().has_sub_node("affinity");
|
||||
|
||||
if (affinity_from_start || affinity_from_launcher) {
|
||||
|
||||
Affinity::Location location { };
|
||||
|
||||
if (affinity_from_launcher)
|
||||
_launcher_xml->xml().with_sub_node("affinity", [&] (Xml_node node) {
|
||||
location = Affinity::Location::from_xml(node); });
|
||||
|
||||
if (affinity_from_start)
|
||||
_start_xml->xml().with_sub_node("affinity", [&] (Xml_node node) {
|
||||
location = Affinity::Location::from_xml(node); });
|
||||
|
||||
xml.node("affinity", [&] () {
|
||||
xml.attribute("xpos", xpos);
|
||||
xml.attribute("ypos", ypos);
|
||||
xml.attribute("width", width);
|
||||
xml.attribute("height", height);
|
||||
xml.attribute("xpos", location.xpos());
|
||||
xml.attribute("ypos", location.ypos());
|
||||
xml.attribute("width", location.width());
|
||||
xml.attribute("height", location.height());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,10 @@ struct Sculpt::Component : Noncopyable
|
||||
uint64_t ram { };
|
||||
size_t caps { };
|
||||
|
||||
Affinity::Space const affinity_space;
|
||||
Affinity::Location affinity_location { 0, 0,
|
||||
affinity_space.width(),
|
||||
affinity_space.height() };
|
||||
Affinity::Space const affinity_space;
|
||||
Affinity::Location affinity_location { 0, 0,
|
||||
affinity_space.width(),
|
||||
affinity_space.height() };
|
||||
|
||||
bool blueprint_known = false;
|
||||
|
||||
@ -75,6 +75,23 @@ struct Sculpt::Component : Noncopyable
|
||||
});
|
||||
}
|
||||
|
||||
void gen_affinity_xml(Xml_generator &xml) const
|
||||
{
|
||||
bool const all_cpus = affinity_space.width() == affinity_location.width()
|
||||
&& affinity_space.height() == affinity_location.height();
|
||||
|
||||
/* omit <affinity> node if all CPUs are used by the component */
|
||||
if (all_cpus)
|
||||
return;
|
||||
|
||||
xml.node("affinity", [&] () {
|
||||
xml.attribute("xpos", affinity_location.xpos());
|
||||
xml.attribute("ypos", affinity_location.ypos());
|
||||
xml.attribute("width", affinity_location.width());
|
||||
xml.attribute("height", affinity_location.height());
|
||||
});
|
||||
}
|
||||
|
||||
bool all_routes_defined() const
|
||||
{
|
||||
bool result = true;
|
||||
|
@ -154,10 +154,7 @@ class Sculpt::Runtime_state : public Runtime_info
|
||||
if (construction.constructed()) {
|
||||
xml.attribute("pkg", construction->path);
|
||||
|
||||
xml.attribute("xpos", construction->affinity_location.xpos());
|
||||
xml.attribute("ypos", construction->affinity_location.ypos());
|
||||
xml.attribute("width", construction->affinity_location.width());
|
||||
xml.attribute("height", construction->affinity_location.height());
|
||||
construction->gen_affinity_xml(xml);
|
||||
|
||||
xml.node("route", [&] () {
|
||||
construction->routes.for_each([&] (Route const &route) {
|
||||
|
@ -406,6 +406,7 @@ struct Sculpt::Popup_dialog : Dialog
|
||||
_selected_user = User();
|
||||
_selected_route.destruct();
|
||||
_menu._level = 0;
|
||||
_resources.destruct();
|
||||
}
|
||||
|
||||
Popup_dialog(Env &env, Refresh &refresh,
|
||||
|
@ -33,9 +33,8 @@ struct Sculpt::Resource_dialog : Noncopyable, Dialog
|
||||
Hoverable_item _space_item { };
|
||||
|
||||
|
||||
Resource_dialog(Affinity::Space space,
|
||||
Affinity::Location loc)
|
||||
: _space(space), _location(loc)
|
||||
Resource_dialog(Affinity::Space space, Affinity::Location location)
|
||||
: _space(space), _location(location)
|
||||
{ }
|
||||
|
||||
void _gen_affinity_entry(Xml_generator &, Start_name const &) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user