Browse Source

Adds redfish support to 'overcloud generate fencing'.

See https://review.openstack.org/#/c/636889/.


Change-Id: Iec99d194d261ae0cdab93e2b1b4ed0d030feae7f
(cherry picked from commit 9314396efc)
tags/9.6.1
Luca Miccini 7 months ago
parent
commit
baaf834db4

+ 12
- 2
tripleo_common/actions/parameters.py View File

@@ -414,9 +414,14 @@ class GenerateFencingParametersAction(base.TripleOAction):
414 414
                 # New-style hardware types (ipmi, etc)
415 415
                 driver_proto = node['pm_type']
416 416
 
417
-            if driver_proto in {'ipmi', 'ipmitool', 'drac', 'idrac', 'ilo'}:
417
+            if driver_proto in {'ipmi', 'ipmitool', 'drac', 'idrac', 'ilo',
418
+                                'redfish'}:
418 419
                 # IPMI fencing driver
419
-                node_data["agent"] = "fence_ipmilan"
420
+                if driver_proto == "redfish":
421
+                    node_data["agent"] = "fence_redfish"
422
+                    params["systems_uri"] = node["pm_system_id"]
423
+                else:
424
+                    node_data["agent"] = "fence_ipmilan"
420 425
                 params["ipaddr"] = node["pm_addr"]
421 426
                 params["passwd"] = node["pm_password"]
422 427
                 params["login"] = node["pm_user"]
@@ -425,6 +430,11 @@ class GenerateFencingParametersAction(base.TripleOAction):
425 430
                         hostmap[mac_addr]["compute_name"]
426 431
                 if "pm_port" in node:
427 432
                     params["ipport"] = node["pm_port"]
433
+                if "redfish_verify_ca" in node:
434
+                    if node["redfish_verify_ca"] == "false":
435
+                        params["ssl_insecure"] = "true"
436
+                    else:
437
+                        params["ssl_insecure"] = "false"
428 438
                 if self.ipmi_lanplus:
429 439
                     params["lanplus"] = self.ipmi_lanplus
430 440
                 if self.delay:

+ 36
- 2
tripleo_common/tests/actions/test_parameters.py View File

@@ -1029,6 +1029,10 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1029 1029
             "11:22:33:44:55:66": {
1030 1030
                 "compute_name": "compute_name_1",
1031 1031
                 "baremetal_name": "baremetal_name_1"
1032
+                },
1033
+            "aa:bb:cc:dd:ee:ff": {
1034
+                "compute_name": "compute_name_4",
1035
+                "baremetal_name": "baremetal_name_4"
1032 1036
                 }
1033 1037
             }
1034 1038
         mock_generate_hostmap.return_value = test_hostmap
@@ -1053,6 +1057,19 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1053 1057
             "mac": [
1054 1058
                 "11:22:33:44:55:66"
1055 1059
             ]
1060
+        }, {
1061
+            # test node using redfish pm
1062
+            "name": "compute-4",
1063
+            "pm_password": "calvin",
1064
+            "pm_type": "redfish",
1065
+            "pm_user": "root",
1066
+            "pm_addr": "172.16.0.1:8000",
1067
+            "pm_port": "8000",
1068
+            "redfish_verify_ca": "false",
1069
+            "pm_system_id": "/redfish/v1/Systems/5678",
1070
+            "mac": [
1071
+                "aa:bb:cc:dd:ee:ff"
1072
+            ]
1056 1073
         }, {
1057 1074
             # This is an extra node that is not in the hostmap, to ensure we
1058 1075
             # cope with unprovisioned nodes
@@ -1064,7 +1081,8 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1064 1081
             "mac": [
1065 1082
                 "22:33:44:55:66:77"
1066 1083
             ]
1067
-        }]
1084
+        }
1085
+        ]
1068 1086
 
1069 1087
         action = parameters.GenerateFencingParametersAction(test_envjson,
1070 1088
                                                             28,
@@ -1075,7 +1093,7 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1075 1093
         result = action.run(mock_ctx)["parameter_defaults"]
1076 1094
 
1077 1095
         self.assertTrue(result["EnableFencing"])
1078
-        self.assertEqual(len(result["FencingConfig"]["devices"]), 2)
1096
+        self.assertEqual(len(result["FencingConfig"]["devices"]), 3)
1079 1097
         self.assertEqual(result["FencingConfig"]["devices"][0], {
1080 1098
                          "agent": "fence_ipmilan",
1081 1099
                          "host_mac": "00:11:22:33:44:55",
@@ -1103,6 +1121,22 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
1103 1121
                              "pcmk_host_list": "compute_name_1"
1104 1122
                              }
1105 1123
                          })
1124
+        self.assertEqual(result["FencingConfig"]["devices"][2], {
1125
+                         "agent": "fence_redfish",
1126
+                         "host_mac": "aa:bb:cc:dd:ee:ff",
1127
+                         "params": {
1128
+                             "delay": 28,
1129
+                             "ipaddr": "172.16.0.1:8000",
1130
+                             "ipport": "8000",
1131
+                             "lanplus": True,
1132
+                             "privlvl": 5,
1133
+                             "login": "root",
1134
+                             "passwd": "calvin",
1135
+                             "systems_uri": "/redfish/v1/Systems/5678",
1136
+                             "ssl_insecure": "true",
1137
+                             "pcmk_host_list": "compute_name_4"
1138
+                             }
1139
+                         })
1106 1140
 
1107 1141
 
1108 1142
 class GetFlattenedParametersActionTest(base.TestCase):

Loading…
Cancel
Save