This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2123570 - [RFE] Only allow setting resource meta attributes which are valid
Summary: [RFE] Only allow setting resource meta attributes which are valid
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: pcs
Version: 8.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe
URL:
Whiteboard:
: 1415234 (view as bug list)
Depends On: 2163699
Blocks: 2123571
TreeView+ depends on / blocked
 
Reported: 2022-09-02 01:40 UTC by Joshua Baker
Modified: 2023-09-22 19:50 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2123571 2163699 (view as bug list)
Environment:
Last Closed: 2023-09-22 19:50:23 UTC
Type: Story
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-7673 0 None Migrated None 2023-09-22 19:50:18 UTC
Red Hat Issue Tracker RHELPLAN-133087 0 None None None 2022-09-02 01:43:40 UTC
Red Hat Knowledge Base (Solution) 6974960 0 None None None 2022-09-07 14:54:34 UTC

Description Joshua Baker 2022-09-02 01:40:56 UTC
Description of problem:

There are no error checks or warnings when setting invalid resource meta attributes. This can lead to unexpected behaviors for users who believed they set a valid option.    


Version-Release number of selected component (if applicable):

$ rpm -q pcs
pcs-0.10.8-1.el8.x86_64


How reproducible:

Set an invalid meta attribute to either a specific resource or for resource defaults:

[root@clusterb-rhel8 ~]# pcs resource defaults update resource-sti=1000
Warning: Defaults do not apply to resources which override them with their own defined values

[root@clusterb-rhel8 ~]# pcs resource update dummy1 meta resource-sti=100

Actual results:

This results in an update to the configuration, but the values won't actually do anything since the attribute are invalid:

[root@clusterb-rhel8 ~]# pcs config
----------------->8---------------------
Resources:
 Resource: dummy1 (class=ocf provider=heartbeat type=Dummy)
  Attributes: fake=1
  Meta Attrs: resource-sti=100
----------------->8---------------------
Resources Defaults:
  Meta Attrs: rsc_defaults-meta_attributes
    resource-sti=1000
    resource-stickiness=1000

Expected results:

A warning or error that prevents an update to configuration, and requests additional "--force" option to set invalid values.

Comment 2 Tomas Jelinek 2022-09-05 14:03:33 UTC
I agree this is unfortunate. The problem is, that users are allowed to set custom meta attributes for their purposes [1]. So there are no 'invalid' meta attributes, there are just meta attributes ignored by pacemaker. Implementing the requested validation would break the use case of setting custom meta attributes. Ken, what's your opinion?

[1]: https://clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Explained/singlehtml/index.html#resource-meta-attributes

Comment 3 Reid Wahl 2022-09-05 22:03:14 UTC
Maybe just a warning (without requiring --force) that the specified meta attribute doesn't match any cluster-defined ones, and the user should make sure they're intentionally setting a custom attribute? That way we don't add friction to a valid use case and possibly break scripts.

Comment 4 Ken Gaillot 2022-09-06 15:27:19 UTC
A warning makes sense. I don't see a problem with requiring --force, but you might want to save that for the next major version.

Pacemaker's behavior is less than ideal here, but changing it would be a massive compatibility break. If we did want to change it, I'd probably keep meta_attributes for user-defined attributes and move the Pacemaker-aware ones to new element(s). But that would be at least a major version away and would keep the old support deprecated for at least another major version.

Comment 5 Tomas Jelinek 2022-09-06 15:40:11 UTC
Thanks for your input. We can go with printing a warning and possibly require --force in the next major version.

Ken, does pacemaker provide a definition of supported meta attributes? Something similar to '/usr/libexec/pacemaker/pacemaker-schedulerd metadata'?

Comment 6 Ken Gaillot 2022-09-06 16:05:01 UTC
(In reply to Tomas Jelinek from comment #5)
> Thanks for your input. We can go with printing a warning and possibly
> require --force in the next major version.
> 
> Ken, does pacemaker provide a definition of supported meta attributes?
> Something similar to '/usr/libexec/pacemaker/pacemaker-schedulerd metadata'?

No. That information is currently not collected or collectable anywhere. Also, meta-attributes are effective only in certain contexts (for example clone-max only matters inside a clone element). So this will not be practical from the pcs side.

I think the only way we could make this simple would be to use a new attributes block for Pacemaker-aware properties, and have the schema enumerate which are allowed where. Then we could rely on schema validation, and pcs wouldn't need any changes. Something like:

    <primitive id="rsc1" ...>
        <control id="...">  <!-- for Pacemaker-aware properties -->
            <nvpair .../>
        </control>
        <meta_attributes id="..."> <!-- for user use, and backward compatibility -->
            <nvpair .../>
        </meta_attributes>
        <instance_attributes id="..."/> <!-- for agent parameters -->
            <nvpair .../>
        </instance_attributes>
    </primitive>

pcs could add a new [control <control options> ...] syntax to commands, but that would require users to change their behavior. Alternatively, pcs could continue using meta for control options, and add a new syntax for user-defined meta_attributes, which would be safer but somewhat confusing.

Thoughts?

Comment 7 Tomas Jelinek 2023-01-23 13:13:31 UTC
(In reply to Ken Gaillot from comment #6)
> (In reply to Tomas Jelinek from comment #5)
> > Thanks for your input. We can go with printing a warning and possibly
> > require --force in the next major version.
> > 
> > Ken, does pacemaker provide a definition of supported meta attributes?
> > Something similar to '/usr/libexec/pacemaker/pacemaker-schedulerd metadata'?
> 
> 
> I think the only way we could make this simple would be to use a new
> attributes block for Pacemaker-aware properties, and have the schema
> enumerate which are allowed where. Then we could rely on schema validation,
> and pcs wouldn't need any changes. Something like:
> 
>     <primitive id="rsc1" ...>
>         <control id="...">  <!-- for Pacemaker-aware properties -->
>             <nvpair .../>
>         </control>
>         <meta_attributes id="..."> <!-- for user use, and backward compatibility -->
>             <nvpair .../>
>         </meta_attributes>
>         <instance_attributes id="..."/> <!-- for agent parameters -->
>             <nvpair .../>
>         </instance_attributes>
>     </primitive>

This doesn't really help. Even if meta-attributes were validated by schema, pcs would have to do its own validation to prevent 'CIB does not conform to schema' errors. From my point of view, this solution adds complexity and backward compatibility problems, while not getting us closer to solution. In the worst case, pcs would have to keep it's own list of allowed meta-attributes' names, possibly lagging behind pacemaker.


Having a definition of meta-attributes provided by pacemaker seems like a better approach to me. If meta-attributes are context dependent, let's build that info into the definition. Either as a CLI option (e.g. pcmk-metaattrs-tool metadata --context primitive|group|bundle|clone|promotable|operation|rsc-defaults|op-defaults) or into XML output as an attribute or element. Thinking about it, a CLI option sounds better, as it would allow using existing OCF schema for the XML.

If meta-attributes were defined this way, pcs could use it to validate both their names and values as well as to print meta-attributes names and their description in a similar manner it does with instance-attributes.

Opinions?

Comment 8 Ken Gaillot 2023-01-23 16:57:51 UTC
(In reply to Tomas Jelinek from comment #7)
> Even if meta-attributes were validated by schema,
> pcs would have to do its own validation to prevent 'CIB does not conform to
> schema' errors. From my point of view, this solution adds complexity and
> backward compatibility problems, while not getting us closer to solution. In
> the worst case, pcs would have to keep it's own list of allowed
> meta-attributes' names, possibly lagging behind pacemaker.

Definitely want to avoid that

> Having a definition of meta-attributes provided by pacemaker seems like a
> better approach to me. If meta-attributes are context dependent, let's build
> that info into the definition. Either as a CLI option (e.g.
> pcmk-metaattrs-tool metadata --context
> primitive|group|bundle|clone|promotable|operation|rsc-defaults|op-defaults)
> or into XML output as an attribute or element. Thinking about it, a CLI
> option sounds better, as it would allow using existing OCF schema for the
> XML.
> 
> If meta-attributes were defined this way, pcs could use it to validate both
> their names and values as well as to print meta-attributes names and their
> description in a similar manner it does with instance-attributes.
> 
> Opinions?

That does make more sense. We can clone this bz for the Pacemaker side.

Comment 9 Tomas Jelinek 2023-01-24 10:26:10 UTC
*** Bug 1415234 has been marked as a duplicate of this bug. ***

Comment 11 RHEL Program Management 2023-09-22 19:48:30 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 12 RHEL Program Management 2023-09-22 19:50:23 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


Note You need to log in before you can comment on or make changes to this bug.