← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1734739] Re: cloud-init mishandles dhcp6 subnets in network_data.json

 

ovirt will change to match openstack, so that no changes are needed.

** Changed in: cloud-init
       Status: New => Invalid

-- 
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/1734739

Title:
  cloud-init mishandles dhcp6 subnets in network_data.json

Status in cloud-init:
  Invalid

Bug description:
  It looks like there's a typo in the helpers/openstack.py
  network_data.json parser.

  With a config like:

  {
    "links" : [ {
      "name" : "test",
      "id" : "test",
      "type" : "vif"
    } ],
    "networks" : [ {
      "netmask" : "255.255.255.0",
      "link" : "test",
      "id" : "test",
      "ip_address" : "192.168.122.201",
      "type" : "ipv4",
      "gateway" : "192.168.122.1"
    }, {
      "link" : "test",
      "id" : "test",
      "type" : "dhcp6"
    } ]
  }

  the resulting network state object is

  Internal State
  !!python/object:cloudinit.net.network_state.NetworkState
  _network_state:
      dns:
          nameservers: []
          search: []
      interfaces:
          !!python/unicode 'test':
              address: null
              gateway: null
              inet: inet
              mac_address: null
              mode: manual
              mtu: null
              name: !!python/unicode 'test'
              subnets:
              -   address: !!python/unicode '192.168.122.201'
                  !!python/unicode 'gateway': !!python/unicode '192.168.122.1'
                  ipv4: true
                  !!python/unicode 'netmask': !!python/unicode '255.255.255.0'
                  !!python/unicode 'type': static
              -   !!python/unicode 'type': dhcp4
              type: physical
      routes: []
  _version: 1

  When it should be

  Internal State
  !!python/object:cloudinit.net.network_state.NetworkState
  _network_state:
      dns:
          nameservers: []
          search: []
      interfaces:
          !!python/unicode 'test':
              address: null
              gateway: null
              inet: inet
              mac_address: null
              mode: manual
              mtu: null
              name: !!python/unicode 'test'
              subnets:
              -   address: !!python/unicode '192.168.122.201'
                  !!python/unicode 'gateway': !!python/unicode '192.168.122.1'
                  ipv4: true
                  !!python/unicode 'netmask': !!python/unicode '255.255.255.0'
                  !!python/unicode 'type': static
              -   !!python/unicode 'type': dhcp6
              type: physical
      routes: []
  _version: 1

  It looks like this is caused by an error on line 570 of
  helpers/openstack.py where the test used is:

  t = 'dhcp6' if network['type'].startswith('ipv6') else 'dhcp4'

  which will always result in 'dhcp4' since the network type is 'dhcp6'

  it looks like changing the test to

  t = 'dhcp6' if network['type'].endswith('6') else 'dhcp4'

  fixes things.

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


References