ClusterLabs / crmsh

Command-line interface for High-Availability cluster management on GNU/Linux systems.
GNU General Public License v2.0
131 stars 94 forks source link

`crm configure` requires both `deprecated` and `obsoletes` params #370

Open nrwahl2 opened 6 years ago

nrwahl2 commented 6 years ago

If a resource's metadata contains a deprecated param (deprecated="1") and a new one that obsoletes it, and both params have required="1", then crm configure requires both parameters. This is unexpected behavior. Only one or the other param should be specified in the CIB.

Example/reproducer:

# rpm -q crmsh fence-agents-vmware-soap redhat-release-server
crmsh-3.0.0-6.1.noarch
fence-agents-vmware-soap-4.0.11-86.el7.x86_64
redhat-release-server-7.5-8.el7.x86_64

# crm configure
crm(live)configure# primitive vmfence stonith:fence_vmware_soap \
   > params ipaddr=1.2.3.4 login=fence_user passwd=secret_pass pcmk_host_map="node1:node-1;node2:node-2"
crm(live)configure# commit
ERROR: vmfence: required parameter ip not defined
ERROR: vmfence: required parameter username not defined
ERROR: vmfence: required parameter plug not defined
Do you still want to commit (y/n)? n
crm(live)configure# quit
bye

# crm configure
crm(live)configure# primitive vmfence stonith:fence_vmware_soap \
   > params ip=1.2.3.4 username=fence_user passwd=secret_pass plug=dummy_val pcmk_host_map="node1:node-1;node2:node-2"
crm(live)configure# commit
ERROR: vmfence: required parameter ipaddr not defined
ERROR: vmfence: required parameter login not defined
Do you still want to commit (y/n)? n
crm(live)configure# quit
bye

# /usr/sbin/fence_vmware_soap -o metadata | egrep 'name="(ip|ipaddr|login|username|plug|pcmk_host_list)"'
    <parameter name="ipaddr" unique="0" required="1" deprecated="1">
    <parameter name="login" unique="0" required="1" deprecated="1">
    <parameter name="plug" unique="0" required="1" obsoletes="port">
    <parameter name="username" unique="0" required="1" obsoletes="login">
    <parameter name="ip" unique="0" required="1" obsoletes="ipaddr">

If the problem is that the deprecated and obsoletes params should not both have required="1", then I can open an issue or BZ against fence-agents.

A secondary, closely related concern is that this tool requires plug, when pcmk_host_map should take care of that requirement. I am likewise unsure here whether the issue should be against crmsh (for metadata parsing) or fence-agents (for metadata output).

krig commented 6 years ago

I am likewise unsure here whether the issue should be against crmsh (for metadata parsing) or fence-agents (for metadata output).

Possibly both.. the metadata does seem incorrect there, plug probably shouldn't be marked as required. But the other problem is that crmsh lacks support for the deprecated attribute. This will need fixing regardless.

liangxin1300 commented 6 years ago

I'm wandering where does these attributes(required|deprecated|obsoletes) defined? Can you give me a link?:) @nrwahl2

nrwahl2 commented 6 years ago

@liangxin1300 Are you asking where the meaning is defined or where these attributes are attached to the fence agent? They're attached to the fence agent's attributes in the metadata.

I'm unable to find definitions in the fence-agents repo including the developer doc. However, two key occurrences in the code:

Metadata spec: https://github.com/ClusterLabs/fence-agents/blob/master/lib/metadata.rng#L17-L23

fencing.py - determines whether attribute has deprecated, obsoletes, or neither: https://github.com/ClusterLabs/fence-agents/blob/master/lib/fencing.py.py#L581-L587

liangxin1300 commented 6 years ago

hi @nrwahl2 , krig has created #322 last year, maybe a solution for this.