From 863368af63eefd431d749848ac5d1a37bbb6ec05 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 3 Feb 2021 11:54:58 +0900 Subject: [PATCH] Fix handling hardware types and drivers when generating fencing parameters This is a partial backport of 812d7e6cbb899983311001d90d6608a0c90f74a5 and fixes handling about new hardware types which doesn't have prefixes like pm_, pxe_ and so on[1]. [1] 73b6ede2bb706c41c331a4fd95399ca0b1e2047d Change-Id: I696581ea9a9fb7bfbefb6a168b37b3e36a2abc3c Closes-Bug: #1924374 --- tripleo_common/actions/parameters.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tripleo_common/actions/parameters.py b/tripleo_common/actions/parameters.py index c960d5b4b..61eb48a18 100644 --- a/tripleo_common/actions/parameters.py +++ b/tripleo_common/actions/parameters.py @@ -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"]