sysconfig renders vlan with TYPE=Ethernet
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Eduardo Otubo |
Bug Description
Distribution: Fedora 28
Cloud provider: None
Network content of /etc/cloud/
network:
version: 1
config:
- type: physical
name: lan1
mac_address: 0c:c4:7a:db:dc:b0
- type: vlan
name: lan1.100
vlan_link: lan1
vlan_id: 100
subnets:
- type: static
address: 192.168.0.2/24
gateway: 192.168.0.1
- 8.8.8.8
- 8.8.4.4
- type: vlan
name: lan1.3900
vlan_link: lan1
vlan_id: 3900
subnets:
- type: static
address: 10.1.0.2/16
gateway:
I am unable to attach logs (no network connection).
$ cloud-init --version
/usr/bin/cloud-init 17.1
The sysconfig renderer leaves the configured "kind" set to the default (ethernet), which results in a config file with "TYPE=Ethernet", which is incorrect and results in the VLAN interface not being created.
$ cat ifcfg-lan1.100
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=lan1.100
GATEWAY=192.168.0.1
IPADDR=192.168.0.2
NETMASK=
ONBOOT=yes
PHYSDEV=lan1
TYPE=Ethernet
USERCTL=no
VLAN=yes
$ ifup lan1.100
Error: Connection activation failed: No suitable device found for this connection.
Removing the offending "TYPE=Ethernet" line from the config file resolves the problem (as does changing it to "TYPE=Vlan").
I altered my configuration to use version 2 of the network configuration data with identical results (problem is in renderer).
Related branches
- Ryan Harper: Needs Information
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 201 lines (+115/-4)3 files modifiedcloudinit/net/sysconfig.py (+30/-1)
tests/unittests/test_distros/test_netconfig.py (+85/-0)
tests/unittests/test_net.py (+0/-3)
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
status: | Confirmed → Triaged |
I also hit this bug. We have late 2020 and I wonder, why this bug still is open?
In current master branch of cloud-init in file:
net/sysconfig.py:
... vlan_interfaces (cls, network_state, iface_contents, flavor): filter_ by_type( 'vlan') state.iter_ interfaces( vlan_filter) : iface_name] 'vlan_id' ) 'VLAN_ID' ] = vlan_id 'ETHERDEVICE' ] = iface_name[ :iface_ name.rfind( '.')] 'PHYSDEV' ] = iface_name[ :iface_ name.rfind( '.')]
687 @classmethod
688 def _render_
689 vlan_filter = renderer.
690 for iface in network_
691 iface_name = iface['name']
692 iface_cfg = iface_contents[
693 if flavor == 'suse':
694 vlan_id = iface.get(
695 if vlan_id:
696 iface_cfg[
697 iface_cfg[
698 else:
699 iface_cfg['VLAN'] = True
700 iface_cfg[
701 iface_cfg. drop('TYPE' )
I think, line 701 should be a fix, right?
Tested it and it works for me:
net.json: ------- ------- ------- ------- ------- ------- ------- ----
-------
network:
version: 1
config: 254.227/ 28"
dns_ nameservers: 28:1:109: 230:254: 227/64" 222:8300: b40e:7c0"
dns_ nameservers: []
- type: physical
name: eth0
subnets:
- type: static
address: "109.230.
gateway: "109.230.254.225"
- "109.230.254.226"
- type: static
address: "2a05:bec0:
gateway: "fe80::
- type: vlan
dns_ nameservers: [] ------- ------- ------- ------- ------- ------- ------- ----
name: eth0.100
vlan_link: eth0
vlan_id: 100
subnets:
- type: static
address: "192.168.0.9/24"
-------
python3 ./net_convert.py --network-data /root/vm- setup/gitlab. roessner- net.de- network. cfg --kind yaml --output-kind sysconfig -D centos -d target
cat target/ etc/sysconfig/ network- scripts/ ifcfg-eth0. 100 255.255. 255.0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEVICE=eth0.100
IPADDR=192.168.0.9
NETMASK=
NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=eth0
USERCTL=no
VLAN=yes
This way, TYPE is removed and all works as expected.
Kind regards
Christian