Browse Source

Enable staging-ovirt (fence_rhevm) fencing agent.

This commit extends actions/parameters to generate
fencing parameters for nodes using staging-ovirt (fence_rhevm).

Given instackenv.json content like:

{
  "nodes":[
{
  "name":"ctrl01",
  "pm_type":"staging-ovirt",
  "mac": [
"56:6f:71:33:00:0d"
  ],
  "arch": "x86_64",
  "pm_user":"admin@internal",
  "pm_password":"redhat",
  "pm_addr":"10.0.0.141",
  "pm_vm_name":"ctrl01"
}
...

Here the generated fence.yaml:

parameter_defaults:
  EnableFencing: true
  FencingConfig:
    devices:
    - agent: fence_rhevm
      host_mac: 56:6f:71:33:00:0d
      params:
        ipaddr: 10.0.0.141
        login: admin@internal
        passwd: redhat
        port: ctrl01
        ssl: 1
        ssl_insecure: 1

And the resulting pacemaker stonith resource:

stonith-fence_rhevm-566f7133000d        (stonith:fence_rhevm:(  Started overcloud-controller-1

To have this working 'out of the box' we assume the worst case
scenario of ovirt-engine using a self-signed certificate, so
we explicitly ssl_insecure=1.
Users/Operators should be aware of this and eventually adjust
the value accordingly.

Change-Id: I3b746eff8367133cec2c6ff03aad25993d26e90c
(cherry picked from commit c13c9cf5a2)
(cherry picked from commit 54482b4f2a)
tags/9.6.1
Luca Miccini 5 months ago
parent
commit
99c29dd7b5

+ 14
- 0
tripleo_common/actions/parameters.py View File

@@ -443,6 +443,20 @@ class GenerateFencingParametersAction(base.TripleOAction):
443 443
                     params["cipher"] = self.ipmi_cipher
444 444
                 if self.ipmi_level:
445 445
                     params["privlvl"] = self.ipmi_level
446
+            elif driver_proto in {'staging-ovirt'}:
447
+                # fence_rhevm
448
+                node_data["agent"] = "fence_rhevm"
449
+                params["ipaddr"] = node["pm_addr"]
450
+                params["passwd"] = node["pm_password"]
451
+                params["login"] = node["pm_user"]
452
+                params["port"] = node["pm_vm_name"]
453
+                params["ssl"] = 1
454
+                params["ssl_insecure"] = 1
455
+                if hostmap:
456
+                    params["pcmk_host_list"] = \
457
+                        hostmap[mac_addr]["compute_name"]
458
+                if self.delay:
459
+                    params["delay"] = self.delay
446 460
             else:
447 461
                 error = ("Unable to generate fencing parameters for %s" %
448 462
                          node["pm_type"])

+ 30
- 1
tripleo_common/tests/actions/test_parameters.py View File

@@ -1033,6 +1033,10 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1033 1033
             "aa:bb:cc:dd:ee:ff": {
1034 1034
                 "compute_name": "compute_name_4",
1035 1035
                 "baremetal_name": "baremetal_name_4"
1036
+                },
1037
+            "bb:cc:dd:ee:ff:gg": {
1038
+                "compute_name": "compute_name_5",
1039
+                "baremetal_name": "baremetal_name_5"
1036 1040
                 }
1037 1041
             }
1038 1042
         mock_generate_hostmap.return_value = test_hostmap
@@ -1070,6 +1074,17 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1070 1074
             "mac": [
1071 1075
                 "aa:bb:cc:dd:ee:ff"
1072 1076
             ]
1077
+        }, {
1078
+            # This is an extra node on oVirt/RHV
1079
+            "name": "control-3",
1080
+            "pm_password": "ovirt-password",
1081
+            "pm_type": "staging-ovirt",
1082
+            "pm_user": "admin@internal",
1083
+            "pm_addr": "3.4.5.6",
1084
+            "pm_vm_name": "control-3",
1085
+            "mac": [
1086
+                "bb:cc:dd:ee:ff:gg"
1087
+            ]
1073 1088
         }, {
1074 1089
             # This is an extra node that is not in the hostmap, to ensure we
1075 1090
             # cope with unprovisioned nodes
@@ -1093,7 +1108,7 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1093 1108
         result = action.run(mock_ctx)["parameter_defaults"]
1094 1109
 
1095 1110
         self.assertTrue(result["EnableFencing"])
1096
-        self.assertEqual(len(result["FencingConfig"]["devices"]), 3)
1111
+        self.assertEqual(len(result["FencingConfig"]["devices"]), 4)
1097 1112
         self.assertEqual(result["FencingConfig"]["devices"][0], {
1098 1113
                          "agent": "fence_ipmilan",
1099 1114
                          "host_mac": "00:11:22:33:44:55",
@@ -1137,6 +1152,20 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1137 1152
                              "pcmk_host_list": "compute_name_4"
1138 1153
                              }
1139 1154
                          })
1155
+        self.assertEqual(result["FencingConfig"]["devices"][3], {
1156
+                         "agent": "fence_rhevm",
1157
+                         "host_mac": "bb:cc:dd:ee:ff:gg",
1158
+                         "params": {
1159
+                             "delay": 28,
1160
+                             "ipaddr": "3.4.5.6",
1161
+                             "login": "admin@internal",
1162
+                             "passwd": "ovirt-password",
1163
+                             "port": "control-3",
1164
+                             "ssl": 1,
1165
+                             "ssl_insecure": 1,
1166
+                             "pcmk_host_list": "compute_name_5"
1167
+                             }
1168
+                         })
1140 1169
 
1141 1170
 
1142 1171
 class GetFlattenedParametersActionTest(base.TestCase):

Loading…
Cancel
Save