Merge "Fix handling hardware types and drivers when generating fencing parameters"
This commit is contained in:
commit
fa0462695f
11
releasenotes/notes/fencing-hw-types-fddcdb6bf6d79414.yaml
Normal file
11
releasenotes/notes/fencing-hw-types-fddcdb6bf6d79414.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes handling hardware types (new-style Ironic drivers) when generating
|
||||||
|
fencing parameters. Also completely removes support for no longer existing
|
||||||
|
``pxe_ssh`` driver.
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``os_auth`` argument to the ``generate_fencing_parameters`` workflow
|
||||||
|
is deprecated and should not be provided. It will be removed in a future
|
||||||
|
version.
|
@ -342,18 +342,16 @@ class GenerateFencingParametersAction(base.TripleOAction):
|
|||||||
"""Generates fencing configuration for a deployment.
|
"""Generates fencing configuration for a deployment.
|
||||||
|
|
||||||
:param nodes_json: list of nodes & attributes in json format
|
:param nodes_json: list of nodes & attributes in json format
|
||||||
:param os_auth: dictionary of OS client auth data (if using pxe_ssh)
|
|
||||||
:param delay: time to wait before taking fencing action
|
:param delay: time to wait before taking fencing action
|
||||||
:param ipmi_level: IPMI user level to use
|
:param ipmi_level: IPMI user level to use
|
||||||
:param ipmi_cipher: IPMI cipher suite to use
|
:param ipmi_cipher: IPMI cipher suite to use
|
||||||
:param ipmi_lanplus: whether to use IPMIv2.0
|
:param ipmi_lanplus: whether to use IPMIv2.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, nodes_json, os_auth, delay,
|
def __init__(self, nodes_json, delay,
|
||||||
ipmi_level, ipmi_cipher, ipmi_lanplus):
|
ipmi_level, ipmi_cipher, ipmi_lanplus):
|
||||||
super(GenerateFencingParametersAction, self).__init__()
|
super(GenerateFencingParametersAction, self).__init__()
|
||||||
self.nodes_json = nodes.convert_nodes_json_mac_to_ports(nodes_json)
|
self.nodes_json = nodes.convert_nodes_json_mac_to_ports(nodes_json)
|
||||||
self.os_auth = os_auth
|
|
||||||
self.delay = delay
|
self.delay = delay
|
||||||
self.ipmi_level = ipmi_level
|
self.ipmi_level = ipmi_level
|
||||||
self.ipmi_cipher = ipmi_cipher
|
self.ipmi_cipher = ipmi_cipher
|
||||||
@ -382,20 +380,14 @@ class GenerateFencingParametersAction(base.TripleOAction):
|
|||||||
|
|
||||||
# Build up fencing parameters based on which Ironic driver this
|
# Build up fencing parameters based on which Ironic driver this
|
||||||
# node is using
|
# node is using
|
||||||
if hostmap and node["pm_type"] == "pxe_ssh":
|
try:
|
||||||
# Ironic fencing driver
|
# Deprecated classic drivers (pxe_ipmitool, etc)
|
||||||
node_data["agent"] = "fence_ironic"
|
driver_proto = node['pm_type'].split('_')[1]
|
||||||
params["auth_url"] = self.os_auth["auth_url"]
|
except IndexError:
|
||||||
params["login"] = self.os_auth["login"]
|
# New-style hardware types (ipmi, etc)
|
||||||
params["passwd"] = self.os_auth["passwd"]
|
driver_proto = node['pm_type']
|
||||||
params["tenant_name"] = self.os_auth["tenant_name"]
|
|
||||||
params["pcmk_host_map"] = "%(compute_name)s:%(bm_name)s" % (
|
if driver_proto in {'ipmi', 'ipmitool', 'drac', 'idrac', 'ilo'}:
|
||||||
{"compute_name": hostmap[mac_addr]["compute_name"],
|
|
||||||
"bm_name": hostmap[mac_addr]["baremetal_name"]})
|
|
||||||
if self.delay:
|
|
||||||
params["delay"] = self.delay
|
|
||||||
elif (node['pm_type'] == 'ipmi' or node["pm_type"].split('_')[1] in
|
|
||||||
("ipmitool", "ilo", "drac")):
|
|
||||||
# IPMI fencing driver
|
# IPMI fencing driver
|
||||||
node_data["agent"] = "fence_ipmilan"
|
node_data["agent"] = "fence_ipmilan"
|
||||||
params["ipaddr"] = node["pm_addr"]
|
params["ipaddr"] = node["pm_addr"]
|
||||||
|
@ -881,7 +881,7 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
|||||||
test_envjson = [{
|
test_envjson = [{
|
||||||
"name": "control-0",
|
"name": "control-0",
|
||||||
"pm_password": "control-0-password",
|
"pm_password": "control-0-password",
|
||||||
"pm_type": "pxe_ipmitool",
|
"pm_type": "ipmi",
|
||||||
"pm_user": "control-0-admin",
|
"pm_user": "control-0-admin",
|
||||||
"pm_addr": "0.1.2.3",
|
"pm_addr": "0.1.2.3",
|
||||||
"pm_port": "0123",
|
"pm_port": "0123",
|
||||||
@ -891,7 +891,8 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
|||||||
}, {
|
}, {
|
||||||
"name": "control-1",
|
"name": "control-1",
|
||||||
"pm_password": "control-1-password",
|
"pm_password": "control-1-password",
|
||||||
"pm_type": "pxe_ssh",
|
# Still support deprecated drivers
|
||||||
|
"pm_type": "pxe_ipmitool",
|
||||||
"pm_user": "control-1-admin",
|
"pm_user": "control-1-admin",
|
||||||
"pm_addr": "1.2.3.4",
|
"pm_addr": "1.2.3.4",
|
||||||
"mac": [
|
"mac": [
|
||||||
@ -902,22 +903,15 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
|||||||
# cope with unprovisioned nodes
|
# cope with unprovisioned nodes
|
||||||
"name": "control-2",
|
"name": "control-2",
|
||||||
"pm_password": "control-2-password",
|
"pm_password": "control-2-password",
|
||||||
"pm_type": "pxe_ipmitool",
|
"pm_type": "ipmi",
|
||||||
"pm_user": "control-2-admin",
|
"pm_user": "control-2-admin",
|
||||||
"pm_addr": "2.3.4.5",
|
"pm_addr": "2.3.4.5",
|
||||||
"mac": [
|
"mac": [
|
||||||
"22:33:44:55:66:77"
|
"22:33:44:55:66:77"
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
test_osauth = {
|
|
||||||
"auth_url": "test://auth.url",
|
|
||||||
"login": "test_os_username",
|
|
||||||
"passwd": "test_os_password",
|
|
||||||
"tenant_name": "test_os_tenant_name",
|
|
||||||
}
|
|
||||||
|
|
||||||
action = parameters.GenerateFencingParametersAction(test_envjson,
|
action = parameters.GenerateFencingParametersAction(test_envjson,
|
||||||
test_osauth,
|
|
||||||
28,
|
28,
|
||||||
5,
|
5,
|
||||||
0,
|
0,
|
||||||
@ -942,15 +936,16 @@ class GenerateFencingParametersActionTestCase(base.TestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.assertEqual(result["FencingConfig"]["devices"][1], {
|
self.assertEqual(result["FencingConfig"]["devices"][1], {
|
||||||
"agent": "fence_ironic",
|
"agent": "fence_ipmilan",
|
||||||
"host_mac": "11:22:33:44:55:66",
|
"host_mac": "11:22:33:44:55:66",
|
||||||
"params": {
|
"params": {
|
||||||
"auth_url": "test://auth.url",
|
|
||||||
"delay": 28,
|
"delay": 28,
|
||||||
"login": "test_os_username",
|
"ipaddr": "1.2.3.4",
|
||||||
"passwd": "test_os_password",
|
"lanplus": True,
|
||||||
"tenant_name": "test_os_tenant_name",
|
"privlvl": 5,
|
||||||
"pcmk_host_map": "compute_name_1:baremetal_name_1"
|
"login": "control-1-admin",
|
||||||
|
"passwd": "control-1-password",
|
||||||
|
"pcmk_host_list": "compute_name_1"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -227,31 +227,6 @@ class oVirtDriverInfo(DriverInfo):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class SshDriverInfo(DriverInfo):
|
|
||||||
DEFAULTS = {'ssh_virt_type': 'virsh'}
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(SshDriverInfo, self).__init__(
|
|
||||||
'ssh',
|
|
||||||
{
|
|
||||||
'pm_addr': 'ssh_address',
|
|
||||||
'pm_user': 'ssh_username',
|
|
||||||
# TODO(dtantsur): support ssh_key_filename as well
|
|
||||||
'pm_password': 'ssh_key_contents',
|
|
||||||
},
|
|
||||||
deprecated_mapping={
|
|
||||||
'pm_virt_type': 'ssh_virt_type',
|
|
||||||
},
|
|
||||||
mandatory_fields=['pm_addr', 'pm_user', 'pm_password'],
|
|
||||||
)
|
|
||||||
|
|
||||||
def validate(self, node):
|
|
||||||
super(SshDriverInfo, self).validate(node)
|
|
||||||
if not node.get('ports')[0]['address']:
|
|
||||||
raise exception.InvalidNode(
|
|
||||||
'Nodes with SSH drivers require at least one PORT')
|
|
||||||
|
|
||||||
|
|
||||||
class iBootDriverInfo(PrefixedDriverInfo):
|
class iBootDriverInfo(PrefixedDriverInfo):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(iBootDriverInfo, self).__init__(
|
super(iBootDriverInfo, self).__init__(
|
||||||
|
@ -10,6 +10,7 @@ workflows:
|
|||||||
a deployment.
|
a deployment.
|
||||||
input:
|
input:
|
||||||
- nodes_json
|
- nodes_json
|
||||||
|
# TODO(dtantsur): remove in Stein (after it is no longer used)
|
||||||
- os_auth
|
- os_auth
|
||||||
- fence_action
|
- fence_action
|
||||||
- delay
|
- delay
|
||||||
@ -29,7 +30,6 @@ workflows:
|
|||||||
action: tripleo.parameters.generate_fencing
|
action: tripleo.parameters.generate_fencing
|
||||||
input:
|
input:
|
||||||
nodes_json: <% $.nodes_json %>
|
nodes_json: <% $.nodes_json %>
|
||||||
os_auth: <% $.os_auth %>
|
|
||||||
fence_action: <% $.fence_action %>
|
fence_action: <% $.fence_action %>
|
||||||
delay: <% $.delay %>
|
delay: <% $.delay %>
|
||||||
ipmi_level: <% $.ipmi_level %>
|
ipmi_level: <% $.ipmi_level %>
|
||||||
|
Loading…
Reference in New Issue
Block a user