← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1874267] [NEW] Bridges are configured as physical nic when delivered by network_data.json

 

Public bug reported:

Bridges are configured as physical nic when delivered by network_data.json
network_data.json
```...
links:
- id: br0
  name: br0
  type: bridge
  bridge_stp: on
  bridge_fd: 0
  bridge_interfaces:
    - underlay0
....
```
/usr/lib/python3/dist-packages/cloudinit/sources/helpers/openstack.py
```
...
if link['type'] in ['bond']: 
...
elif link['type'] in ['vlan']:
else:
    if link['type'] not in KNOWN_PHYSICAL_TYPES:
         LOG.warning('Unknown network_data link type (%s); treating as'
         ' physical', link['type'])
    cfg.update({'type': 'physical', 'mac_address': link_mac_addr})
```
There is no switch for "bridge"
It replaces type "bridge" with 'physical'

To solve this
```
elif link['type'] in ['bridge']:
  params = {}
  for k, v in link.items():
    if k == 'bridge_interfaces':
      continue
    elif k.startswith('bridge'):
       params.update({k: v})
    cfg.update({'params': params,
              'bridge_interfaces': link['bridge_interfaces']})
```

** 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/1874267

Title:
  Bridges are configured as physical nic when delivered by
  network_data.json

Status in cloud-init:
  New

Bug description:
  Bridges are configured as physical nic when delivered by network_data.json
  network_data.json
  ```...
  links:
  - id: br0
    name: br0
    type: bridge
    bridge_stp: on
    bridge_fd: 0
    bridge_interfaces:
      - underlay0
  ....
  ```
  /usr/lib/python3/dist-packages/cloudinit/sources/helpers/openstack.py
  ```
  ...
  if link['type'] in ['bond']: 
  ...
  elif link['type'] in ['vlan']:
  else:
      if link['type'] not in KNOWN_PHYSICAL_TYPES:
           LOG.warning('Unknown network_data link type (%s); treating as'
           ' physical', link['type'])
      cfg.update({'type': 'physical', 'mac_address': link_mac_addr})
  ```
  There is no switch for "bridge"
  It replaces type "bridge" with 'physical'

  To solve this
  ```
  elif link['type'] in ['bridge']:
    params = {}
    for k, v in link.items():
      if k == 'bridge_interfaces':
        continue
      elif k.startswith('bridge'):
         params.update({k: v})
      cfg.update({'params': params,
                'bridge_interfaces': link['bridge_interfaces']})
  ```

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


Follow ups