Fix handling hardware types and drivers when generating fencing parameters

This is a partial backport of 812d7e6cbb
and fixes handling about new hardware types which doesn't have prefixes
like pm_, pxe_ and so on[1].

[1] 73b6ede2bb

Change-Id: I696581ea9a9fb7bfbefb6a168b37b3e36a2abc3c
Closes-Bug: #1924374
This commit is contained in:
Takashi Kajinami 2021-02-03 11:54:58 +09:00
parent b2495f222e
commit 863368af63
1 changed files with 8 additions and 2 deletions

View File

@ -378,6 +378,13 @@ class GenerateFencingParametersAction(base.TripleOAction):
# Build up fencing parameters based on which Ironic driver this
# node is using
try:
# Deprecated classic drivers (pxe_ipmitool, etc)
driver_proto = node['pm_type'].split('_')[1]
except IndexError:
# New-style hardware types (ipmi, etc)
driver_proto = node['pm_type']
if hostmap and node["pm_type"] == "pxe_ssh":
# Ironic fencing driver
node_data["agent"] = "fence_ironic"
@ -404,8 +411,7 @@ class GenerateFencingParametersAction(base.TripleOAction):
hostmap[mac_addr]["compute_name"]
if self.delay:
params["delay"] = self.delay
elif (node['pm_type'] == 'ipmi' or node["pm_type"].split('_')[1] in
("ipmitool", "ilo", "drac")):
elif driver_proto in {'ipmi', 'ipmitool', 'drac', 'idrac', 'ilo'}:
# IPMI fencing driver
node_data["agent"] = "fence_ipmilan"
params["ipaddr"] = node["pm_addr"]