From 0551943ca828dec83666e28b46140d8fa3bb5fe6 Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Wed, 17 Jun 2020 14:20:41 +0800 Subject: [PATCH] Accept IPv6 link local address during interface validation Link local address is a valid address on IPv6 network when we are using SLAAC instead of DHCPv6, current interface validation bypass link local address and fails the introspection. Interfaces without link carrier don't have link local addresses so this should be fine. Change-Id: I4cf195fc8906a2d91989df3f588e1e96ca9684b1 Story: 2007816 Task: 40094 (cherry picked from commit 71666178f43ef899e724cade3d1cd33e3c4916e2) --- ironic_inspector/plugins/standard.py | 3 +-- .../test/unit/test_plugins_standard.py | 19 ------------------- ...t-link-local-address-1fbb9cbdc3f980bb.yaml | 5 +++++ 3 files changed, 6 insertions(+), 21 deletions(-) create mode 100644 releasenotes/notes/accept-link-local-address-1fbb9cbdc3f980bb.yaml diff --git a/ironic_inspector/plugins/standard.py b/ironic_inspector/plugins/standard.py index 501aa32c9..e0342dbc9 100644 --- a/ironic_inspector/plugins/standard.py +++ b/ironic_inspector/plugins/standard.py @@ -220,8 +220,7 @@ class ValidateInterfacesHook(base.ProcessingHook): LOG.debug('Skipping interface %s as it was not PXE booting', name, data=data) continue - elif CONF.processing.add_ports != 'all' and ( - not ip or netaddr.IPAddress(ip).is_link_local()): + elif CONF.processing.add_ports != 'all' and not ip: LOG.debug('Skipping interface %s as it did not have ' 'an IP address assigned during the ramdisk run', name, data=data) diff --git a/ironic_inspector/test/unit/test_plugins_standard.py b/ironic_inspector/test/unit/test_plugins_standard.py index 4f3af5c30..13dfc1c75 100644 --- a/ironic_inspector/test/unit/test_plugins_standard.py +++ b/ironic_inspector/test/unit/test_plugins_standard.py @@ -222,25 +222,6 @@ class TestValidateInterfacesHookBeforeProcessing(test_base.NodeTest): self.assertRaisesRegex(utils.Error, 'No suitable interfaces found', self.hook.before_processing, self.data) - def test_skipped_interfaces_with_local_address(self): - CONF.set_override('add_ports', 'active', 'processing') - self.inventory['interfaces'] = [ - # local interface (by IPv4 address) - {'name': 'em1', 'mac_address': '22:22:22:22:22:22', - 'ipv4_address': '127.0.0.1'}, - # local interface (by IPv6 address) - {'name': 'em2', 'mac_address': '33:33:33:33:33:33', - 'ipv6_address': '::1'}, - # interface only with local-link address - {'name': 'em3', 'mac_address': '44:44:44:44:44:44', - 'ipv6_address': 'fe80::4644:44ff:fe44:4444'}, - # interface only with local-link address with suffix - {'name': 'em4', 'mac_address': '55:55:55:55:55:55', - 'ipv6_address': 'fe80::5755:55ff:fe55:5555%em4'}, - ] - self.assertRaisesRegex(utils.Error, 'No suitable interfaces found', - self.hook.before_processing, self.data) - def test_interfaces_with_ipv6_addresses_only(self): CONF.set_override('add_ports', 'all', 'processing') self.inventory['interfaces'] = [ diff --git a/releasenotes/notes/accept-link-local-address-1fbb9cbdc3f980bb.yaml b/releasenotes/notes/accept-link-local-address-1fbb9cbdc3f980bb.yaml new file mode 100644 index 000000000..2b8c7258e --- /dev/null +++ b/releasenotes/notes/accept-link-local-address-1fbb9cbdc3f980bb.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes the issue that IPv6 link local addresses are ignored during + interface validation which fails introspection.