** Description changed:

- === Begin SRU Template === 
- [Impact] 
+ === Begin SRU Template ===
+ [Impact]
  When booting with bonds provided in networking configuration, cloud-init
  can fail as it attempts to rename the bond device to an interface.
  
  [Test Case]
-  * download ubuntu cloud image
-  * mount image, enable proposed, update, upgrade cloud-init
-  * run 'bond-rename-launch' as provided.
-  * login to kvm guest as 'ubuntu:passw0rd'
-  * sudo cloud-init init
+  * download ubuntu cloud image
+  * mount image, enable proposed, update, upgrade cloud-init
+  * run 'bond-rename-launch' as provided.
+  * login to kvm guest as 'ubuntu:passw0rd'
+  * sudo cloud-init init
  
  the 'cloud-init init' above would fail before in an attempt
  to rename a bond device.  It will succeed now, as it will realize
  that it does not have anything to do.
-    
+ 
  [Regression Potential]
  Should be small. regressions would be certainly related to
  bond or vlan configurations.
-  
+ 
  === End SRU Template ===
- 
  
  1. Zesty amd64
  2. cloud-init 0.7.9-47-gc81ea53-0ubuntu1
  
  3. cloud-init boots with a bond network config and does not attempt to
  rename bond0
  
  4. cloud-init init (net mode) fails when it attempts to rename a bond
  interface
  
  Running with the following network config (2 nics)
  config:
  -   mac_address: bc:76:4e:06:96:b3
      name: interface0
      type: physical
  -   mac_address: bc:76:4e:04:88:41
      name: interface1
      type: physical
  -   bond_interfaces:
      - interface0
      - interface1
      name: bond0
      params:
          bond_miimon: 100
          bond_mode: 802.3ad
          bond_xmit_hash_policy: layer3+4
      type: bond
  -   name: bond0.108
      subnets:
      -   address: 65.61.151.38
          netmask: 255.255.255.252
          routes:
          -   gateway: 65.61.151.37
              netmask: 0.0.0.0
              network: 0.0.0.0
          type: static
      -   address: 2001:4800:78ff:1b:be76:4eff:fe06:96b3
          netmask: 'ffff:ffff:ffff:ffff::'
          routes:
          -   gateway: 2001:4800:78ff:1b::1
              netmask: '::'
              network: '::'
          type: static
      type: vlan
      vlan_id: '108'
      vlan_link: bond0
  -   name: bond0.208
      subnets:
      -   address: 10.184.225.122
          netmask: 255.255.255.252
          routes:
          -   gateway: 10.184.225.121
              netmask: 255.240.0.0
              network: 10.176.0.0
          -   gateway: 10.184.225.121
              netmask: 255.240.0.0
              network: 10.208.0.0
          type: static
      type: vlan
      vlan_id: '208'
      vlan_link: bond0
  -   address: 72.3.128.240
      type: nameserver
  -   address: 72.3.128.241
      type: nameserver
  
  During cloud-init init --local; the network configuration is rendered and 
brought up
  bond0 is a virtual interface which uses the MAC from one of the slaves.
  
  In cloud-init init (net) mode, we check if the interfaces are named properly;
  When cloud-init collects the current_rename_info, it reads the MAC address of
  each device listed in /sys/class/net;  this includes *virtual* devices, like 
bonds/bridges
  Then it looks up an interface name by MAC, however the bond and one of the 
interfaces
  have the same value which results in cloud-init attempting to rename bond0
  
  The solution is to not collect MACs of virtual interfaces for rename-purpose 
since
  virtual devices do not ever get renamed; their name is defined by the config.
  
  diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
  index ea649cc..e2a50ad 100755
  --- a/cloudinit/net/__init__.py
  +++ b/cloudinit/net/__init__.py
  @@ -14,6 +14,7 @@ from cloudinit import util
  
   LOG = logging.getLogger(__name__)
   SYS_CLASS_NET = "/sys/class/net/"
  +SYS_DEV_VIRT_NET = "/sys/devices/virtual/net/"
   DEFAULT_PRIMARY_INTERFACE = 'eth0'
  
  @@ -205,7 +206,11 @@ def _get_current_rename_info(check_downable=True):
       """Collect information necessary for rename_interfaces."""
       names = get_devicelist()
       bymac = {}
  +    virtual = os.listdir(SYS_DEV_VIRT_NET)
       for n in names:
  +        # do not attempt to rename virtual interfaces
  +        if n in virtual:
  +            continue
           bymac[get_interface_mac(n)] = {
               'name': n, 'up': is_up(n), 'downable': None}
  
  Log file of a failure:
  http://paste.ubuntu.com/24084999/
+ 
+ Related bugs:
+  * bug 1682871: cloud-init attempts to rename vlans / get_interfaces_by_mac 
does not filter vlans

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1669860

Title:
  cloud-init attempts to rename bonds

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

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to