Adds redfish support to 'overcloud generate fencing'.
See https://review.openstack.org/#/c/636889/. Still work in progress. Change-Id: Iec99d194d261ae0cdab93e2b1b4ed0d030feae7f
This commit is contained in:
parent
2c5d3f5f7d
commit
9314396efc
|
@ -413,9 +413,14 @@ class GenerateFencingParametersAction(base.TripleOAction):
|
||||||
# New-style hardware types (ipmi, etc)
|
# New-style hardware types (ipmi, etc)
|
||||||
driver_proto = node['pm_type']
|
driver_proto = node['pm_type']
|
||||||
|
|
||||||
if driver_proto in {'ipmi', 'ipmitool', 'drac', 'idrac', 'ilo'}:
|
if driver_proto in {'ipmi', 'ipmitool', 'drac', 'idrac', 'ilo',
|
||||||
|
'redfish'}:
|
||||||
# IPMI fencing driver
|
# IPMI fencing driver
|
||||||
node_data["agent"] = "fence_ipmilan"
|
if driver_proto == "redfish":
|
||||||
|
node_data["agent"] = "fence_redfish"
|
||||||
|
params["systems_uri"] = node["pm_system_id"]
|
||||||
|
else:
|
||||||
|
node_data["agent"] = "fence_ipmilan"
|
||||||
params["ipaddr"] = node["pm_addr"]
|
params["ipaddr"] = node["pm_addr"]
|
||||||
params["passwd"] = node["pm_password"]
|
params["passwd"] = node["pm_password"]
|
||||||
params["login"] = node["pm_user"]
|
params["login"] = node["pm_user"]
|
||||||
|
@ -424,6 +429,11 @@ class GenerateFencingParametersAction(base.TripleOAction):
|
||||||
hostmap[mac_addr]["compute_name"]
|
hostmap[mac_addr]["compute_name"]
|
||||||
if "pm_port" in node:
|
if "pm_port" in node:
|
||||||
params["ipport"] = node["pm_port"]
|
params["ipport"] = node["pm_port"]
|
||||||
|
if "redfish_verify_ca" in node:
|
||||||
|
if node["redfish_verify_ca"] == "false":
|
||||||
|
params["ssl_insecure"] = "true"
|
||||||
|
else:
|
||||||
|
params["ssl_insecure"] = "false"
|
||||||
if self.ipmi_lanplus:
|
if self.ipmi_lanplus:
|
||||||
params["lanplus"] = self.ipmi_lanplus
|
params["lanplus"] = self.ipmi_lanplus
|
||||||
if self.delay:
|
if self.delay:
|
||||||
|
|
|
@ -1030,6 +1030,10 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
||||||
"11:22:33:44:55:66": {
|
"11:22:33:44:55:66": {
|
||||||
"compute_name": "compute_name_1",
|
"compute_name": "compute_name_1",
|
||||||
"baremetal_name": "baremetal_name_1"
|
"baremetal_name": "baremetal_name_1"
|
||||||
|
},
|
||||||
|
"aa:bb:cc:dd:ee:ff": {
|
||||||
|
"compute_name": "compute_name_4",
|
||||||
|
"baremetal_name": "baremetal_name_4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mock_generate_hostmap.return_value = test_hostmap
|
mock_generate_hostmap.return_value = test_hostmap
|
||||||
|
@ -1054,6 +1058,19 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
||||||
"mac": [
|
"mac": [
|
||||||
"11:22:33:44:55:66"
|
"11:22:33:44:55:66"
|
||||||
]
|
]
|
||||||
|
}, {
|
||||||
|
# test node using redfish pm
|
||||||
|
"name": "compute-4",
|
||||||
|
"pm_password": "calvin",
|
||||||
|
"pm_type": "redfish",
|
||||||
|
"pm_user": "root",
|
||||||
|
"pm_addr": "172.16.0.1:8000",
|
||||||
|
"pm_port": "8000",
|
||||||
|
"redfish_verify_ca": "false",
|
||||||
|
"pm_system_id": "/redfish/v1/Systems/5678",
|
||||||
|
"mac": [
|
||||||
|
"aa:bb:cc:dd:ee:ff"
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
# This is an extra node that is not in the hostmap, to ensure we
|
# This is an extra node that is not in the hostmap, to ensure we
|
||||||
# cope with unprovisioned nodes
|
# cope with unprovisioned nodes
|
||||||
|
@ -1065,7 +1082,8 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
||||||
"mac": [
|
"mac": [
|
||||||
"22:33:44:55:66:77"
|
"22:33:44:55:66:77"
|
||||||
]
|
]
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
|
||||||
action = parameters.GenerateFencingParametersAction(test_envjson,
|
action = parameters.GenerateFencingParametersAction(test_envjson,
|
||||||
28,
|
28,
|
||||||
|
@ -1076,7 +1094,7 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
||||||
result = action.run(mock_ctx)["parameter_defaults"]
|
result = action.run(mock_ctx)["parameter_defaults"]
|
||||||
|
|
||||||
self.assertTrue(result["EnableFencing"])
|
self.assertTrue(result["EnableFencing"])
|
||||||
self.assertEqual(len(result["FencingConfig"]["devices"]), 2)
|
self.assertEqual(len(result["FencingConfig"]["devices"]), 3)
|
||||||
self.assertEqual(result["FencingConfig"]["devices"][0], {
|
self.assertEqual(result["FencingConfig"]["devices"][0], {
|
||||||
"agent": "fence_ipmilan",
|
"agent": "fence_ipmilan",
|
||||||
"host_mac": "00:11:22:33:44:55",
|
"host_mac": "00:11:22:33:44:55",
|
||||||
|
@ -1104,6 +1122,22 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
||||||
"pcmk_host_list": "compute_name_1"
|
"pcmk_host_list": "compute_name_1"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
self.assertEqual(result["FencingConfig"]["devices"][2], {
|
||||||
|
"agent": "fence_redfish",
|
||||||
|
"host_mac": "aa:bb:cc:dd:ee:ff",
|
||||||
|
"params": {
|
||||||
|
"delay": 28,
|
||||||
|
"ipaddr": "172.16.0.1:8000",
|
||||||
|
"ipport": "8000",
|
||||||
|
"lanplus": True,
|
||||||
|
"privlvl": 5,
|
||||||
|
"login": "root",
|
||||||
|
"passwd": "calvin",
|
||||||
|
"systems_uri": "/redfish/v1/Systems/5678",
|
||||||
|
"ssl_insecure": "true",
|
||||||
|
"pcmk_host_list": "compute_name_4"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class GetFlattenedParametersActionTest(base.TestCase):
|
class GetFlattenedParametersActionTest(base.TestCase):
|
||||||
|
|
Loading…
Reference in New Issue