Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: libpacemaker: Get container attr from assigned node, if any #3132

Merged
merged 4 commits into from
Jun 15, 2023

Conversation

nrwahl2
Copy link
Contributor

@nrwahl2 nrwahl2 commented Jun 15, 2023

promotion_attr_value() should get a container's promotion score from the host to which it's assigned (if it's been assigned), rather than the host on which it's running.

This is adapted from the first part of old PR #2313.

This commit adds a new pe__rsc_node flag enum containing values for
assigned, current, and pending. This indicates the criterion used to
look up a resource's location.

After a compatibility break, native_location() could use these flags
instead of an int.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Use enum pe__rsc_node in pe_node_attribute_calculated() to determine
which container host (assigned or current) to get the attribute value
from. For now, there's no use case for pending.

Pass pe__rsc_node_current for existing calls, since that maintains the
existing behavior.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
promotion_attr_value() should get a container's promotion score from
the host to which it's assigned (if it's been assigned), rather than the
host on which it's running.

Ref T489

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Update outputs after previous commit (get container's promotion score
from assigned host).

There are a few changes to scores, as well as dot and exp files. The
behavior in the bundle-interleave-start test appears to be an
improvement.

Ref T489

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Copy link
Contributor

@kgaillot kgaillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful

@kgaillot kgaillot merged commit 207df13 into ClusterLabs:main Jun 15, 2023
1 check passed

CRM_CHECK((rsc != NULL) && (node != NULL) && (name != NULL), return NULL);

if (pcmk_is_set(rsc->flags, pe_rsc_provisional)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if pe_node_attribute_calculated() should do this on its own instead of taking an argument... which would eliminate the need for the enum pe__rsc_node type altogether (until a compatibility break, when we can use it to replace the magic int argument of native_location()). Although I guess we could pass an enum pe__rsc_node to native_location() even now as long as we don't change the signature, since the values are defined as {0, 1, 2}.

The only other caller of pe_node_attribute_calculated() is get_node_score(), which gets called only at unpack time.

I hadn't looked too closely at the callers this time around, just cleaned up my old commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants