|
| 1 | +# Configure STONITH With fence_vmare Fencing Agent |
| 2 | + |
| 3 | +>[!NOTE] |
| 4 | +>All examples of using fencing agent for vmware in [RHEL documentation](https://access.redhat.com/solutions/306233) are with `-ssl` option ( or `-z`). That “Default” behavior has changed from just checking any certificate to just signed certs that can be validated. Hence in testing use the `–ssl-insecure`. Can use default if you have a valid certificate. |
| 5 | +
|
| 6 | +## Manually Test Fencing Device |
| 7 | + |
| 8 | +The options that are passed in the example below have the following usage: `-a` is IP of Vsphere, `-l` is username, `-p` is password, `-n` is node name you want to fence. Can use `-v` as verbose mode to debug. |
| 9 | + |
| 10 | +```bash |
| 11 | +sudo cd /sbin |
| 12 | +sudo ./fence_vmware_soap -a 172.16.50.50 -l stonithuser -p 'MyStrongPassword1!' --ssl-insecure --action status -n esxi-rhel7-c |
| 13 | +``` |
| 14 | +Output: |
| 15 | +```bash |
| 16 | +/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html |
| 17 | +Status: ON |
| 18 | +``` |
| 19 | + |
| 20 | +## Create Fencing Agent Resource |
| 21 | + |
| 22 | +To create the resource run the following commands: |
| 23 | +```bash |
| 24 | +sudo pcs stonith create esxi-rhel7-c_fence fence_vmware_soap ipaddr=172.16.50.50 ssl_insecure=1 login=stonithuser passwd='MyStrongPassword1!' pcmk_host_list=esxi-rhel7-c |
| 25 | +``` |
| 26 | + |
| 27 | +## Check Status |
| 28 | + |
| 29 | +Run the following commands to check the status of the cluster nodes and reources: |
| 30 | +```bash |
| 31 | +sudo pcs status |
| 32 | +``` |
| 33 | +Sample output: |
| 34 | +```bash |
| 35 | +3 nodes and 5 resources configured |
| 36 | +… |
| 37 | +… |
| 38 | +Full list of resources: |
| 39 | + |
| 40 | +Master/Slave Set: ag_cluster-master [ag_cluster] |
| 41 | + Masters: [ dl380g7-07 ] |
| 42 | + Slaves: [ dl380g7-08 ] |
| 43 | + Stopped: [ esxi-rhel7-c ] |
| 44 | +virtualip (ocf::heartbeat:IPaddr2): Started dl380g7-07 |
| 45 | +esxi-rhel7-c_fence (stonith:fence_vmware_soap): Started dl380g7-08 |
| 46 | +``` |
| 47 | + |
| 48 | +## Testing |
| 49 | + |
| 50 | +```bash |
| 51 | +sudo pcs stonith fence esxi-rhel7-c |
| 52 | +``` |
| 53 | +You can see it will turn the VM off and then back on: |
| 54 | +  |
| 55 | + |
| 56 | + ## VMware Permissions |
| 57 | + |
| 58 | +On VMware vSphere, in order to use limited set of permissions, create a specific user in ESXI to not use root: |
| 59 | +  |
| 60 | + |
| 61 | +Created a Role with only subset of permissions: |
| 62 | +  |
| 63 | + |
| 64 | +Tie the 2 together aka assign user to the role: |
| 65 | +  |
| 66 | +  |
| 67 | +  |
0 commit comments