Bug 1748805

Summary: [man/help] incorrect wording in documentation of crm_resource RA parameter validation
Product: Red Hat Enterprise Linux 8 Reporter: Patrik Hagara <phagara>
Component: pacemakerAssignee: Ken Gaillot <kgaillot>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: high    
Version: 8.1CC: cluster-maint, msmazova
Target Milestone: pre-dev-freeze   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pacemaker-2.0.3-1.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 15:38:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1752538    
Bug Blocks:    

Description Patrik Hagara 2019-09-04 08:19:35 UTC
This bug was initially created as a copy of Bug #1637020

(In reply to Ken Gaillot from comment #9)
> (In reply to Patrik Hagara from comment #7)
> <snip>
> > > [root@virt-042 ~]# crm_resource --help
> > [...]
> > >      --validate		Call the validate-all action.  There are two different things that can be validated.  One
> > > 				method is to validate the resource given by the -r option.  The other method is to validate
> > > 				a not-yet-existing resource.  This method requires the --class, --agent, and --provider
> > > 				arguments, plus at least one --option argument.
> > [...]
> > 
> > * option present in manual page:
> > 
> > > [root@virt-042 ~]# man crm_resource
> > [...]
> > >    Commands:
> > >        --validate
> > >               Call  the  validate-all  action.   There  are  two  different  things  that can be validated.  One method is to validate the resource given by the -r option.  The other method is to validate a
> > >               not-yet-existing resource.  This method requires the --class, --agent, and --provider arguments, plus at least one --option argument.
> > [...]
> 
> These should say something like "and may take any number of --option
> arguments"
> 
> <snip>
> 
> > Issue #1: Is there any technical reason for having these 3 separate options
> > instead of using the pcs-esque syntax (ie. a single
> > "<class>:<provider>:<agent>" string, passed to eg. the "--agent" option
> > while getting rid of the others)? It really seems like a bad decision to me,
> > UX-wise.
> 
> Good point -- no, but it's already been released upstream, so it has to be
> kept for backward compatibility. I suppose we could accept either style. In
> any case, it's intended more for pcs to call rather than end users, so it
> won't really affect anyone.
>  
> > * validate not-yet-existing resource, no --option used:
> > 
> > > [root@virt-042 ~]# crm_resource --validate --class ocf --provider heartbeat --agent Delay
> > > Operation validate-all for test (ocf:heartbeat:Delay) returned: 'ok' (0)
> > > [root@virt-042 ~]# echo $?
> > > 0
> > 
> > Issue #2: Notice how the help text and manual page lie about the requirement
> > for --option usage.
> 
> as mentioned above
>  
> > * validate not-yet-existing resource, option name unknown to RA:
> > 
> > > [root@virt-042 ~]# crm_resource --validate --class ocf --provider heartbeat --agent Delay --option foodelay=2
> > > Operation validate-all for test (ocf:heartbeat:Delay) returned: 'ok' (0)
> > > [root@virt-042 ~]# echo $?
> > > 0
> > 
> > Issue #3: crm_resource reports 'ok' and successful exit code, even though an
> > option name unknown to the resource agent is used. If administrator decides
> > to actually create a resource with such option, an error is (correctly)
> > raised:
> > 
> > > [root@virt-042 ~]# pcs resource create foodelay ocf:heartbeat:Delay foodelay=1
> > > Error: invalid resource option 'foodelay', allowed options are: 'mondelay', 'startdelay', 'stopdelay', 'trace_file', 'trace_ra', use --force to override
> > 
> > I see no reason to ever use --force in the above command, and consequently
> > for crm_resource --validate to return success in such a situation.
> 
> This is actually an artifact of how the different components interact. pcs
> is the one enforcing the allowed options, not pacemaker or the resource
> agent -- so calling crm_resource directly skips that. When pcs implements
> its interface to this capability, it should do the same enforcement there.
> 
> It would also be possible for resource agents to make their validate action
> fail if given unrecognized parameters, but at this point, no resource agent
> does.
>  
> It's probably too late to get a new build just to update the help/man text,
> so we can open a separate BZ for that.

Comment 1 Patrik Hagara 2019-09-30 17:03:35 UTC
qa_ack+, simple manual page text change

Comment 2 Ken Gaillot 2019-10-02 00:21:27 UTC
Fixed upstream by commit 6427bda4

New help text:

     --validate			Validate resource configuration by calling agent's validate-all action.
				The configuration may be specified either by giving an existing
				resource name with -r, or by specifying --class, --agent, and
				--provider arguments, along with any number of --option arguments.

Comment 4 Markéta Smazová 2020-01-15 17:54:24 UTC
Before fix
    [root@virt-029 ~]# rpm -q pacemaker
    pacemaker-2.0.2-3.el8_1.2.x86_64

The current wording of man/help:

    [root@virt-029 ~]# crm_resource --help
    [...]

    --validate			Call the validate-all action.  There are two different things that can be validated.  One
				    method is to validate the resource given by the -r option.  The other method is to validate
				    a not-yet-existing resource.  This method requires the --class, --agent, and --provider
				    arguments, plus at least one --option argument.
				    
    [...]

    [root@virt-026 ~]# man crm_resource
    [...]
    Commands:
           --validate
                  Call the validate-all action.  There are two different things that can be validated.  One method is to  validate  the
                  resource  given by the -r option.  The other method is to validate a not-yet-existing resource.  This method requires
                  the --class, --agent, and --provider arguments, plus at least one --option argument.
    [...]


There is an incorrect wording in the last sentence: "This method requires the --class, --agent, and --provider arguments, plus at least one --option argument."


After fix
    [root@virt-024 ~]# rpm -q pacemaker
    pacemaker-2.0.3-3.el8.x86_64

The current wording of man/help:

    [root@virt-024 ~]# crm_resource --help
    [...]
    Commands:
         --validate			Validate resource configuration by calling agent's validate-all action.
				    The configuration may be specified either by giving an existing
				    resource name with -r, or by specifying --class, --agent, and
				    --provider arguments, along with any number of --option arguments.

    [...]

    [root@virt-024 ~]# man crm_resource
    [...]
    Commands:
           --validate
                  Validate resource configuration by calling agent's validate-all action.  The configu‐
                  ration may be specified either by giving an existing resource name  with  -r,  or  by
                  specifying  --class,  --agent,  and  --provider  arguments,  along with any number of
                  --option arguments.
    [...]
              
The wording in the documentation has been corrected. Now it matches with comment#2.

Comment 6 errata-xmlrpc 2020-04-28 15:38:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:1609