Merge "Do not use ironic/nova for generate_fencing"

This commit is contained in:
Zuul 2021-02-24 23:30:46 +00:00 committed by Gerrit Code Review
commit 654de18ec6
2 changed files with 3 additions and 23 deletions

View File

@ -567,15 +567,11 @@ class StackParametersTest(base.TestCase):
}
]
ironic = mock.MagicMock()
compute = mock.MagicMock()
result = stack_parameters.generate_fencing_parameters(
ironic, compute, test_envjson,
28, 5, 0, True)['parameter_defaults']
test_envjson, 28, 5, 0, True)['parameter_defaults']
self.assertTrue(result["EnableFencing"])
self.assertEqual(len(result["FencingConfig"]["devices"]), 4)
self.assertEqual(len(result["FencingConfig"]["devices"]), 5)
self.assertEqual(result["FencingConfig"]["devices"][0], {
"agent": "fence_ipmilan",
"host_mac": "00:11:22:33:44:55",
@ -587,7 +583,6 @@ class StackParametersTest(base.TestCase):
"privlvl": 5,
"login": "control-0-admin",
"passwd": "control-0-password",
"pcmk_host_list": "compute_name_0"
}
})
self.assertEqual(result["FencingConfig"]["devices"][1], {
@ -600,7 +595,6 @@ class StackParametersTest(base.TestCase):
"privlvl": 5,
"login": "control-1-admin",
"passwd": "control-1-password",
"pcmk_host_list": "compute_name_1"
}
})
self.assertEqual(result["FencingConfig"]["devices"][2], {
@ -615,7 +609,6 @@ class StackParametersTest(base.TestCase):
"passwd": "calvin",
"systems_uri": "/redfish/v1/Systems/5678",
"ssl_insecure": "true",
"pcmk_host_list": "compute_name_4"
}
})
self.assertEqual(result["FencingConfig"]["devices"][3], {
@ -629,7 +622,6 @@ class StackParametersTest(base.TestCase):
"port": "control-3",
"ssl": 1,
"ssl_insecure": 1,
"pcmk_host_list": "compute_name_5"
}
})

View File

@ -126,9 +126,8 @@ def update_role_parameters(swift, heat, ironic, nova, role,
return update_parameters(swift, heat, parameters, container)
def generate_fencing_parameters(ironic, compute, nodes_json, delay,
def generate_fencing_parameters(nodes_json, delay,
ipmi_level, ipmi_cipher, ipmi_lanplus):
hostmap = nodes.generate_hostmap(ironic, compute)
fence_params = {"EnableFencing": True, "FencingConfig": {}}
devices = []
nodes_json = nodes.convert_nodes_json_mac_to_ports(nodes_json)
@ -142,11 +141,6 @@ def generate_fencing_parameters(ironic, compute, nodes_json, delay,
mac_addr = node['ports'][0]['address'].lower()
node_data["host_mac"] = mac_addr
# If the MAC isn't in the hostmap, this node hasn't been
# provisioned, so no fencing parameters are necessary
if hostmap and mac_addr not in hostmap:
continue
# Build up fencing parameters based on which Ironic driver this
# node is using
try:
@ -168,9 +162,6 @@ def generate_fencing_parameters(ironic, compute, nodes_json, delay,
params["ipaddr"] = node["pm_addr"]
params["passwd"] = node["pm_password"]
params["login"] = node["pm_user"]
if hostmap:
params["pcmk_host_list"] = \
hostmap[mac_addr]["compute_name"]
if "pm_port" in node:
params["ipport"] = node["pm_port"]
if "redfish_verify_ca" in node:
@ -193,9 +184,6 @@ def generate_fencing_parameters(ironic, compute, nodes_json, delay,
params["port"] = node["pm_vm_name"]
params["ssl"] = 1
params["ssl_insecure"] = 1
if hostmap:
params["pcmk_host_list"] = \
hostmap[mac_addr]["compute_name"]
if delay:
params["delay"] = delay
else: