Drop deprecated "macs" field in nodes_json

In change I74d4178dbb0cfe8c934ce15e3e7c9bb1c469de10
the "macs" field in nodes_json was deprecated and
replaced by the "ports" field.

It has been several cycles with a deprecation warning
in the logs. Remove convert_nodes_json_mac_to_ports
which keept backward compatibility.

Depends-On: Ia4fa4b950114c5fcc787a7ffb957360c65c850c9
Depends-On: Ib520d5e8366159917076c35cf80efb4b5fcffca6
Change-Id: I559cc656758843a8b1432069952b8d917fc4649a
This commit is contained in:
Harald Jensås 2021-06-18 15:51:11 +02:00
parent 5836974cf2
commit 8e18444393
4 changed files with 21 additions and 26 deletions

View File

@ -0,0 +1,7 @@
---
other:
- |
The compatibility wrapper for the deprecated field: ``macs`` in nodes JSON
*(instackenv.json)* has been removed. The ``macs`` field is no longer
supported as it was replaced by ``ports`` in the Stein release.

View File

@ -108,8 +108,8 @@ class StackParametersTest(base.TestCase):
"pm_user": "control-0-admin",
"pm_addr": "0.1.2.3",
"pm_port": "0123",
"mac": [
"00:11:22:33:44:55"
"ports": [
{"address": "00:11:22:33:44:55"},
]
}, {
"name": "control-1",
@ -118,8 +118,8 @@ class StackParametersTest(base.TestCase):
"pm_type": "pxe_ipmitool",
"pm_user": "control-1-admin",
"pm_addr": "1.2.3.4",
"mac": [
"11:22:33:44:55:66"
"ports": [
{"address": "11:22:33:44:55:66"}
]
}, {
# test node using redfish pm
@ -131,8 +131,8 @@ class StackParametersTest(base.TestCase):
"pm_port": "8000",
"redfish_verify_ca": "false",
"pm_system_id": "/redfish/v1/Systems/5678",
"mac": [
"aa:bb:cc:dd:ee:ff"
"ports": [
{"address": "aa:bb:cc:dd:ee:ff"}
]
}, {
# This is an extra node on oVirt/RHV
@ -142,8 +142,8 @@ class StackParametersTest(base.TestCase):
"pm_user": "admin@internal",
"pm_addr": "3.4.5.6",
"pm_vm_name": "control-3",
"mac": [
"bb:cc:dd:ee:ff:gg"
"ports": [
{"address": "bb:cc:dd:ee:ff:gg"}
]
}, {
# This is an extra node that is not in the hostmap, to ensure we
@ -153,8 +153,8 @@ class StackParametersTest(base.TestCase):
"pm_type": "ipmi",
"pm_user": "control-2-admin",
"pm_addr": "2.3.4.5",
"mac": [
"22:33:44:55:66:77"
"ports": [
{"address": "22:33:44:55:66:77"}
]
}
]

View File

@ -36,20 +36,6 @@ _KNOWN_INTERFACE_FIELDS = [
CTLPLANE_NETWORK = 'ctlplane'
def convert_nodes_json_mac_to_ports(nodes_json):
for node in nodes_json:
if node.get('mac'):
LOG.warning('Key mac is deprecated, please use ports.')
for address in node['mac']:
try:
node['ports'].append({'address': address})
except KeyError:
node['ports'] = [{'address': address}]
del node['mac']
return nodes_json
class DriverInfo(object):
"""Class encapsulating field conversion logic."""
DEFAULTS = {}
@ -631,6 +617,10 @@ def validate_nodes(nodes_list):
except exception.InvalidNode as exc:
failures.append((index, exc))
if node.get('macs'):
failures.append('The "macs" field is not longer supported. '
'Please use the "ports" field instead.')
for port in node.get('ports', ()):
if not netutils.is_valid_mac(port['address']):
failures.append((index, 'MAC address %s is invalid' %

View File

@ -15,7 +15,6 @@
# limitations under the License.
import logging
from tripleo_common.utils import nodes
from tripleo_common.utils import stack as stack_utils
LOG = logging.getLogger(__name__)
@ -25,7 +24,6 @@ def generate_fencing_parameters(nodes_json, delay,
ipmi_level, ipmi_cipher, ipmi_lanplus):
fence_params = {"EnableFencing": True, "FencingConfig": {}}
devices = []
nodes_json = nodes.convert_nodes_json_mac_to_ports(nodes_json)
for node in nodes_json:
node_data = {}