← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1863827] [NEW] cloud-init network config version 2 changes device name even I have match section and no name in match

 

Public bug reported:

Per the documentation here: 
https://cloudinit.readthedocs.io/en/18.5/topics/network-config-format-v2.html
It reads: (for ethernet and wifi)
"It is valid to specify no match rules at all, in which case the ID field is simply the interface name to be matched. This is mostly useful if you want to keep simple cases simple, and it’s how network device configuration has been done for a long time.

If there are match: rules, then the ID field is a purely opaque name
which is only being used for references from definitions of compound
devices in the config."

Per my understanding, If I have match: rule, the ID is only a reference
key for cloudinit, the generated network configuration file should re-
use my existing device name, such like eth0, eno1 etc.

However, even I have a match: rule, it will change the device name to
the ID defined in network config version 2. Here is an example:

# cat network-config
version: 2
ethernets:
# opaque ID for physical interfaces, only referred to by other stanzas
  id0:
    match:
      macaddress: 52:54:00:af:bd:38
    addresses:
      - 135.251.84.250/27
    gateway4: 135.251.84.225

Target OS and cloud-init version:
OS: RHEL7.7 or CentOS7.7
Cloud-init: 18.5
Existing Device name: eth0

Expected result:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
GATEWAY=135.251.84.225
HWADDR=52:54:00:af:bd:38
IPADDR=135.251.84.250
NETMASK=255.255.255.224
ONBOOT=yes
TYPE=Ethernet
USERCTL=no


Real result:
# cat /etc/sysconfig/network-scripts/ifcfg-id0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=id0
GATEWAY=135.251.84.225
HWADDR=52:54:00:af:bd:38
IPADDR=135.251.84.250
NETMASK=255.255.255.224
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by parse-kickstart
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
BOOTPROTO="dhcp"
DEVICE="eth0"
ONBOOT="yes"
UUID="851c242a-74a5-4491-beba-c914fd71b68f"

# ip a
2: id0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:af:bd:38 brd ff:ff:ff:ff:ff:ff
    inet 135.251.84.250/27 brd 135.251.84.255 scope global noprefixroute id0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feaf:bd38/64 scope link
       valid_lft forever preferred_lft forever


You can see cloud-init created an extra ifcfg-id0 device and rename eth0 to id0. This is not expected.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1863827

Title:
  cloud-init network config version 2 changes device name even I have
  match section and no name in match

Status in cloud-init:
  New

Bug description:
  Per the documentation here: 
  https://cloudinit.readthedocs.io/en/18.5/topics/network-config-format-v2.html
  It reads: (for ethernet and wifi)
  "It is valid to specify no match rules at all, in which case the ID field is simply the interface name to be matched. This is mostly useful if you want to keep simple cases simple, and it’s how network device configuration has been done for a long time.

  If there are match: rules, then the ID field is a purely opaque name
  which is only being used for references from definitions of compound
  devices in the config."

  Per my understanding, If I have match: rule, the ID is only a
  reference key for cloudinit, the generated network configuration file
  should re-use my existing device name, such like eth0, eno1 etc.

  However, even I have a match: rule, it will change the device name to
  the ID defined in network config version 2. Here is an example:

  # cat network-config
  version: 2
  ethernets:
  # opaque ID for physical interfaces, only referred to by other stanzas
    id0:
      match:
        macaddress: 52:54:00:af:bd:38
      addresses:
        - 135.251.84.250/27
      gateway4: 135.251.84.225

  Target OS and cloud-init version:
  OS: RHEL7.7 or CentOS7.7
  Cloud-init: 18.5
  Existing Device name: eth0

  Expected result:
  # cat /etc/sysconfig/network-scripts/ifcfg-eth0
  BOOTPROTO=none
  DEFROUTE=yes
  DEVICE=eth0
  GATEWAY=135.251.84.225
  HWADDR=52:54:00:af:bd:38
  IPADDR=135.251.84.250
  NETMASK=255.255.255.224
  ONBOOT=yes
  TYPE=Ethernet
  USERCTL=no

  
  Real result:
  # cat /etc/sysconfig/network-scripts/ifcfg-id0
  # Created by cloud-init on instance boot automatically, do not edit.
  #
  BOOTPROTO=none
  DEFROUTE=yes
  DEVICE=id0
  GATEWAY=135.251.84.225
  HWADDR=52:54:00:af:bd:38
  IPADDR=135.251.84.250
  NETMASK=255.255.255.224
  ONBOOT=yes
  TYPE=Ethernet
  USERCTL=no
  # cat /etc/sysconfig/network-scripts/ifcfg-eth0
  # Generated by parse-kickstart
  IPV6INIT="yes"
  IPV6_AUTOCONF="yes"
  BOOTPROTO="dhcp"
  DEVICE="eth0"
  ONBOOT="yes"
  UUID="851c242a-74a5-4491-beba-c914fd71b68f"

  # ip a
  2: id0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
      link/ether 52:54:00:af:bd:38 brd ff:ff:ff:ff:ff:ff
      inet 135.251.84.250/27 brd 135.251.84.255 scope global noprefixroute id0
         valid_lft forever preferred_lft forever
      inet6 fe80::5054:ff:feaf:bd38/64 scope link
         valid_lft forever preferred_lft forever

  
  You can see cloud-init created an extra ifcfg-id0 device and rename eth0 to id0. This is not expected.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1863827/+subscriptions