Bug 1389530

Summary: sysconfig.py fails to configure network
Product: [Fedora] Fedora Reporter: Dusty Mabe <dustymabe>
Component: cloud-initAssignee: Garrett Holmstrom <gholms>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: adimania, apevec, gholms, Jan.van.Eldik, lars, mattdm, shardy, s
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cloud-init-0.7.9-4.fc26, cloud-init-0.7.9-4.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-30 05:02:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dusty Mabe 2016-10-27 20:03:18 UTC
-------------
this is tracked upstream in https://bugs.launchpad.net/cloud-init/+bug/1637252
we need to track that bug and backport the patch when it gets fixed.
-------------

Cloud-init sysconfig.py does not render the subnet configuration properly when the datasource provides a network configruation.

This was seen on Fedora 25 in digital ocean when working with their team to enable 25 on Digital Ocean. 


```
Cloud-init v. 0.7.8 running 'init-local' at Wed, 26 Oct 2016 21:49:31 +0000. Up 6.08 seconds.
2016-10-26 21:49:31,477 - util.py[WARNING]: failed stage init-local
failed run of stage init-local
------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/cloudinit/cmd/main.py", line 521, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.5/site-packages/cloudinit/cmd/main.py", line 280, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3.5/site-packages/cloudinit/stages.py", line 650, in apply_network_config
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python3.5/site-packages/cloudinit/distros/__init__.py", line 162, in apply_network_config
    dev_names = self._write_network_config(netconfig)
  File "/usr/lib/python3.5/site-packages/cloudinit/distros/rhel.py", line 73, in _write_network_config
    self._net_renderer.render_network_state("/", ns)
  File "/usr/lib/python3.5/site-packages/cloudinit/net/sysconfig.py", line 389, in render_network_state
    network_state).items():
  File "/usr/lib/python3.5/site-packages/cloudinit/net/sysconfig.py", line 371, in _render_sysconfig
    cls._render_physical_interfaces(network_state, iface_contents)
  File "/usr/lib/python3.5/site-packages/cloudinit/net/sysconfig.py", line 297, in _render_physical_interfaces
    start=len(iface.children)):
AttributeError: 'dict' object has no attribute 'children
```


the provided network configuration from the infrastructure (vendor datasource) was:

```
{
   "config": [
      {
         "type": "physical",
         "name": "eth0",
         "mac_address": "22:56:a1:05:b2:02",
         "subnets": [
            {
               "type": "static",
               "gateway": "45.55.64.1",
               "dns_nameservers": [
                  "2001:4860:4860::8844",
                  "2001:4860:4860::8888",
                  "8.8.8.8"
               ],
               "netmask": "255.255.224.0",
               "address": "45.55.90.166",
               "control": "auto"
            },
            {
               "type": "static",
               "address": "2604:A880:0800:0010:0000:0000:1BE2:5001/64",
               "gateway": "2604:A880:0800:0010:0000:0000:0000:0001",
               "dns_nameservers": [
                  "2001:4860:4860::8844",
                  "2001:4860:4860::8888",
                  "8.8.8.8"
               ],
               "control": "auto"
            },
            {
               "type": "static",
               "address": "10.17.0.8",
               "netmask": "255.255.0.0",
               "control": "auto"
            }
         ]
      },
      {
         "type": "physical",
         "name": "eth1",
         "mac_address": "3e:62:82:25:1e:d3",
         "subnets": [
            {
               "type": "static",
               "address": "10.132.71.147",
               "netmask": "255.255.0.0",
               "control": "auto"
            }
         ]
      }
   ],
   "version": 1
}
```

Comment 1 Lars Kellogg-Stedman 2017-02-16 21:06:56 UTC
There are actually two bugs here, one in cloud-init and one in NetworkManager.

(1) The cloud-init bug meant that cloud-init wasn't generating the network interface configuration files correctly.  This is fixed in a patch proposed in https://bugs.launchpad.net/cloud-init/+bug/1665441.

(2) Even with (1) in place, the generated configuration was not compatible with NetworkManager because of the way it was handling alias interface configurations.  This has been fixed upstream in https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=a8f0d88596d8dd2b807a7b0adee272c4f077dade.

Comment 2 Lars Kellogg-Stedman 2017-02-17 20:15:59 UTC
The fix for https://bugs.launchpad.net/cloud-init/+bug/1665441 has merged upstream.

Comment 3 Fedora Update System 2017-03-14 23:35:34 UTC
cloud-init-0.7.9-4.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-83671c0fa0

Comment 4 Fedora Update System 2017-03-15 04:24:58 UTC
cloud-init-0.7.9-4.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-83671c0fa0

Comment 5 Fedora Update System 2017-03-20 22:20:03 UTC
cloud-init-0.7.9-4.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2017-03-27 21:09:50 UTC
cloud-init-0.7.9-4.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-b8b79a540c

Comment 7 Fedora Update System 2017-03-29 04:23:05 UTC
cloud-init-0.7.9-4.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-b8b79a540c

Comment 8 Fedora Update System 2017-03-30 01:20:58 UTC
cloud-init-0.7.9-4.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.