-
Notifications
You must be signed in to change notification settings - Fork 343
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
Feature: tools: List common fencing resource instance attributes via crm_resource #3399
Conversation
6ba3a1f
to
f9d25b6
Compare
f9d25b6
to
01c437d
Compare
rebased on main |
aa7813c
to
c1f267a
Compare
c1f267a
to
b1a5381
Compare
Went ahead and added primitive meta-attributes. I can break this up at any point, preferably somewhere after There are a lot of commits but most of them are trivial. |
b1a5381
to
1fc5e3b
Compare
Added missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome
tools/crm_resource.c
Outdated
g_set_error(&error, PCMK__EXITC_ERROR, CRM_EX_USAGE, | ||
"Invalid --list-options value '%s'. Allowed values: " | ||
PCMK_VALUE_FENCING, | ||
pcmk__s(options.opt_list, "(BUG: none)")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to do validation in an option callback when practical, so invalid arguments are handled consistently (by glib). In this case we could save the filter rather than the text in options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this was another case where I was trying to allow invalid values as long as the LAST value was valid. I've got no problem changing it as you described. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think validation should take precedence over last-wins, since otherwise it could obscure an error (consider a script that incorrectly adds a value intended to be used as a default, then sometimes correctly adds a different value after it)
@@ -20,6 +20,10 @@ extern "C" { | |||
* \ingroup core | |||
*/ | |||
|
|||
// String equivalents of enum rsc_role_e | |||
|
|||
#define PCMK_ROLE_STOPPED "Stopped" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left these internal since external code can use pcmk_role_text(v)
to get them. However they can be used in the CIB, so I suppose this makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my thinking. It's not required -- we could rely on pcmk_role_text()
, and use literal strings in the option metadata -- but this has been our usual approach for strings used in the CIB.
What I really dislike is having these string constants split across public and internal header files. But I don't want to expose unknown and the legacy ones.
lib/common/options.c
Outdated
N_("Number of seconds after a failed action for this resource before " | ||
"acting as if the failure had not occurred, and potentially " | ||
"allowing the resource back to the node on which it failed. " | ||
"A value of 0 indicates that this feature is disabled."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really need to update all these descriptions ... someday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. For the most part, I copied from Pacemaker Explained, sometimes updating if I noticed obvious errors.
@@ -472,6 +472,7 @@ static GOptionEntry query_entries[] = { | |||
{ "list-options", 0, G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, command_cb, | |||
"List all available options of the given type\n" | |||
INDENT "Allowed values:\n" | |||
INDENT PCMK__VALUE_PRIMITIVE "(primitive resource meta-attributes), " | |||
INDENT PCMK_VALUE_FENCING " (parameters common to all fencing resources)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason just primitive is internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! PCMK_VALUE_FENCING
already existed as a public constant for the "requires" meta-attribute. We don't need PCMK__VALUE_PRIMITIVE
for anything public yet.
Though we could use it for resource variant. I've got a personal TODO note for resource variant strings... whether they should have their own constants (PCMK_VALUE
or a new PCMK_<something_else>
), or just use the existing PCMK_XE
constants in all contexts.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1fc5e3b
to
8057c95
Compare
rebased on main |
Nothing uses this yet Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Nothing uses this yet. It's not necessary for filtering the options in the fencing_params array. However, it will be useful for telling pcmk__daemon_metadata() which option list to use and for storing the option list as an enum in crm_resource. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This lists all the parameters that are common to all fencing resources as an OCF-like metadata XML string. Bump the CRM_FEATURE_SET. Ref T620 Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Not used yet Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Not used yet Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This lists all the meta-attributes applicable to a primitive resource as an OCF-like metadata XML string. Bump the CRM_FEATURE_SET. Ref T620 Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Ref T620 Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Fix formatting of stop_start and note that promote/demote are affected by is-managed/maintenance. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Unused since 73a5d63. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
8057c95
to
6056905
Compare
retest this please |
@kgaillot There's a race condition in CI right now. Fabio would like Chrissie to look at the logs before we merge this PR (which clears the logs). She's out today, so we need to hold off. |
… 1168817 https://build.opensuse.org/request/show/1168817 by user yan_gao + anag+factory - Update to version 2.1.7+20240411.81041cf0b: - libcrmcommon: Avoid use-after-free in mark_xml_changes() - libcrmcommon: Mark parents dirty in pcmk__mark_xml_created() - Update to version 2.1.7+20240410.ae4b38ab5: - scheduler: deprecate Nagios and Upstart resources even if built with --enable-compat-2.0 (gh#ClusterLabs/pacemaker#3417) - Update to version 2.1.7+20240410.74b7a09c5: - tools: New crm_resource --list-options=primitive option (gh#ClusterLabs/pacemaker#3399) - libcrmcommon: Use PCMK_VALUE_VERSION as option type (gh#ClusterLabs/pacemaker#3399) - libcrmcommon: Use PCMK_VALUE_TIMEOUT as option type (gh#ClusterLabs/pacemaker#3399) - libcrmcommon: Use PCMK_VALUE_SCORE as option type (gh#ClusterLabs/pacemaker#3399) - libcrmcommon: Use PCMK_VALUE_NONNEGATIVE_INTEGER as opt type (gh#Clu
Next step on T620. This allows us to use
pcmk__daemon_metadata()
in the fencer and deprecate the daemon metadata command.The plan is to use a similar approach in
crm_resource
for the various kinds of resource meta-attributes. Their descriptions will have to be pulled from Pacemaker Explained since we don't have a nice template sitting in another C file :)It might also be nice for
crm_resource --list-options
to accept the name of a resource and output all the meta-attributes that apply to it (for example, clone and primitive meta-attributes for a clone resource). But that's not strictly required, and it might get messy/counter-intuitive if we don't include instance attributes... or if we do.Edit: went ahead and added primitive meta-attributes. I can break this up at any point, preferably somewhere after
--list-options=fencing
.There are a lot of commits but most of them are trivial.