summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/net/eni.py9
-rw-r--r--cloudinit/net/sysconfig.py3
-rw-r--r--tests/unittests/test_net.py29
3 files changed, 35 insertions, 6 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index 530922b5..a9a80c95 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -94,7 +94,7 @@ def _iface_add_attrs(iface, index, ipv4_subnet_mtu):
]
renames = {'mac_address': 'hwaddress'}
- if iface['type'] not in ['bond', 'bridge', 'vlan']:
+ if iface['type'] not in ['bond', 'bridge', 'infiniband', 'vlan']:
ignore_map.append('mac_address')
for key, value in iface.items():
@@ -472,9 +472,10 @@ class Renderer(renderer.Renderer):
order = {
'loopback': 0,
'physical': 1,
- 'bond': 2,
- 'bridge': 3,
- 'vlan': 4,
+ 'infiniband': 2,
+ 'bond': 3,
+ 'bridge': 4,
+ 'vlan': 5,
}
sections = []
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 4e656768..e3815968 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -330,7 +330,8 @@ class Renderer(renderer.Renderer):
old_value = iface.get(old_key)
if old_value is not None:
# only set HWADDR on physical interfaces
- if old_key == 'mac_address' and iface['type'] != 'physical':
+ if (old_key == 'mac_address' and
+ iface['type'] not in ['physical', 'infiniband']):
continue
iface_cfg[new_key] = old_value
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index f5a9cae6..d2201998 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -1176,6 +1176,12 @@ iface eth4 inet manual
# control-manual eth5
iface eth5 inet dhcp
+auto ib0
+iface ib0 inet static
+ address 192.168.200.7/24
+ mtu 9000
+ hwaddress a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1
+
auto bond0
iface bond0 inet6 dhcp
bond-mode active-backup
@@ -1457,7 +1463,19 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
ONBOOT=no
STARTMODE=manual
TYPE=Ethernet
- USERCTL=no""")
+ USERCTL=no"""),
+ 'ifcfg-ib0': textwrap.dedent("""\
+ BOOTPROTO=none
+ DEVICE=ib0
+ HWADDR=a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1
+ IPADDR=192.168.200.7
+ MTU=9000
+ NETMASK=255.255.255.0
+ NM_CONTROLLED=no
+ ONBOOT=yes
+ STARTMODE=auto
+ TYPE=InfiniBand
+ USERCTL=no"""),
},
'yaml': textwrap.dedent("""
version: 1
@@ -1532,6 +1550,15 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
vlan_id: 200
subnets:
- type: dhcp4
+ # An infiniband
+ - type: infiniband
+ name: ib0
+ mac_address: >-
+ a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1
+ subnets:
+ - type: static
+ address: 192.168.200.7/24
+ mtu: 9000
# A bridge.
- type: bridge
name: br0