Description of problem:
When creating a resource, pcs automatically adds resource actions as operations to the resource. These are copied from resource agent metadata. Currently pcs copies monitor, start, stop, promote and demote operations. Pcs should also copy migrate_to, migrate_from, notify, and reload operations. These operations should also be displayed when running the "pcs resource describe" command.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. pcs resource describe ocf:heartbeat:VirtualDomain
2. pcs resource create test ocf:heartbeat:VirtualDomain
1. only start, stop and monitor operations are listed
2. only start, stop and monitor operations are added to the new resource
1. migrate_to and migrate_from operations listed as well
2. migrate_to and migrate_from operations created as well
This has also been requested upstream, with a difference to support actions not defined by the ocf standard as well: https://github.com/ClusterLabs/pcs/issues/132
Created attachment 1326101 [details]
proposed fix + tests
All actions / operations defined in resource agent's metadata (except meta-data, status and validate-all) are now copied to the CIB when creating a resource.
Created attachment 1326141 [details]
fix - sanitize operation id + tests
[vm-rhel72-1 ~] $ rpm -q pcs
[vm-rhel72-1 ~] $ pcs resource describe ocf:heartbeat:VirtualDomain|grep "^ migrate_\(from\|to\)"
migrate_from: interval=0s timeout=60
migrate_to: interval=0s timeout=120
[vm-rhel72-1 ~] $ pcs resource create test ocf:heartbeat:VirtualDomain --force
Warning: required resource option 'config' is missing
[vm-rhel72-1 ~] $ pcs cluster cib --config | grep 'id="test"' -A8
<primitive class="ocf" id="test" provider="heartbeat" type="VirtualDomain">
<op id="test-migrate_from-interval-0s" interval="0s" name="migrate_from" timeout="60"/>
<op id="test-migrate_to-interval-0s" interval="0s" name="migrate_to" timeout="120"/>
<op id="test-monitor-interval-10" interval="10" name="monitor" timeout="30"/>
<op id="test-start-interval-0s" interval="0s" name="start" timeout="90"/>
<op id="test-stop-interval-0s" interval="0s" name="stop" timeout="90"/>
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.