HomeClusterLabs Projects

Low: tools: Fix handling certain error codes in crm_resource.

Description

Low: tools: Fix handling certain error codes in crm_resource.

It is possible, at the bottom of crm_resource, to end up in a situation
where rc is pcmk_rc_ok, but exit_code contains some error value. This
results in an error message like "Error performing operation: OK", which
is obviously terrible.

The idea behind this fix is that when we get to the done label, we won't
use rc again. Any value contained in rc will have been converted to a
crm_exit_t beforehand, and so we only need to worry about exit_code when
doing the final error reporting.

The way to accomplish this is that anywhere in the code that there's a
"goto done", we need to use pcmk_rc2exitc to make sure exit_code is set
correctly and just forget about rc. And then throughout the big command
switch block, we use rc for just about everything and do the error code
conversion just before hitting the done label.

There's one extra wrinkle here - ban_or_move needs to be checked for
whether it returned EINVAL or not. If so, that needs to be converted to
CRM_EX_USAGE prior to running pcmk_rc2exitc. That function will map
EINVAL to CRM_EX_SOFTWARE, which is not right.

Details

Provenance
clumensAuthored on May 20 2021, 11:32 AM
Parents
rP4edf50cc97b2: Doc: ChangeLog: update for 2.1.0-rc2 release
Branches
Unknown
Tags
Unknown

Event Timeline