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: set fail-count to INFINITY for fatal failures #3769

Merged

Conversation

gao-yan
Copy link
Member

@gao-yan gao-yan commented Dec 16, 2024

... to be consistent with what controller does with update_failcount()

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.

thanks

*/

#define PCMK__OPT_FAILED_STOP_OFFSET "failed-stop-offset"
#define PCMK__OPT_FAILED_START_OFFSET "failed-start-offset"
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks :)

These are purely internal, not set by the user, so an XA name in crm/common/xml_names_internal.h would be better

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense.

@@ -93,7 +93,7 @@ inject_transient_attr(pcmk__output_t *out, xmlNode *cib_node,
void
pcmk__inject_failcount(pcmk__output_t *out, cib_t *cib_conn, xmlNode *cib_node,
const char *resource, const char *task,
guint interval_ms, int exit_status)
guint interval_ms, int exit_status, const char *offset)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add to the doxygen comment above as well

I'm thinking a bool would be clearer since we don't actually use the value

Copy link
Member Author

Choose a reason for hiding this comment

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

Add to the doxygen comment above as well

Ah, missed it.

I'm thinking a bool would be clearer since we don't actually use the value

I was thinking it was kind of straight-forward to pass the value of failed_start_offset or failed_stop_offset to be used rather than parsing them outside of pcmk__inject_failcount().

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be fine with that, as long as the doxygen makes clear that the only thing that makes any difference is whether it's "INFINITY" or not

value = pcmk__itoa(failcount + 1);

if (pcmk_str_is_infinity(offset)) {
value = strdup(offset);
Copy link
Contributor

Choose a reason for hiding this comment

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

We prefer pcmk__str_copy() now to assert on failure

Copy link
Member Author

Choose a reason for hiding this comment

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

This is where the value of offset is technically used. But it's also fine to simply copy PCMK_VALUE_INFINITY based on the value of a bool fatal or bool infinity parameter.

Copy link
Member Author

@gao-yan gao-yan left a comment

Choose a reason for hiding this comment

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

Thanks for review.

*/

#define PCMK__OPT_FAILED_STOP_OFFSET "failed-stop-offset"
#define PCMK__OPT_FAILED_START_OFFSET "failed-start-offset"
Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense.

@@ -93,7 +93,7 @@ inject_transient_attr(pcmk__output_t *out, xmlNode *cib_node,
void
pcmk__inject_failcount(pcmk__output_t *out, cib_t *cib_conn, xmlNode *cib_node,
const char *resource, const char *task,
guint interval_ms, int exit_status)
guint interval_ms, int exit_status, const char *offset)
Copy link
Member Author

Choose a reason for hiding this comment

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

Add to the doxygen comment above as well

Ah, missed it.

I'm thinking a bool would be clearer since we don't actually use the value

I was thinking it was kind of straight-forward to pass the value of failed_start_offset or failed_stop_offset to be used rather than parsing them outside of pcmk__inject_failcount().

value = pcmk__itoa(failcount + 1);

if (pcmk_str_is_infinity(offset)) {
value = strdup(offset);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is where the value of offset is technically used. But it's also fine to simply copy PCMK_VALUE_INFINITY based on the value of a bool fatal or bool infinity parameter.

…_FAILED_STOP_OFFSET

Besides, use PCMK_VALUE_INFINITY constant instead of "INFINITY".
... to be consistent with what controller does with update_failcount()
@gao-yan gao-yan force-pushed the crm_simulate-fail-count-fatal-failures branch from 99a3ed6 to 103dcb4 Compare December 17, 2024 10:30
@kgaillot kgaillot merged commit c236bb3 into ClusterLabs:main Dec 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants