New Question

cloudbase-init does not support more than 1 NIC

asked 2014-11-14 11:06:57 +0300

Hoang gravatar image

updated 2014-11-14 11:29:35 +0300


we get this problem since a week, so we digged into the cloudbase-init code and landed at ... [cloudbaseinit/plugins/windows/]

    content_path = network_config['content_path']
    content_name = content_path.rsplit('/', 1)[-1]
    debian_network_conf = service.get_content(content_name)

    LOG.debug('network config content:\n%s' % debian_network_conf)

    # TODO (alexpilotti): implement a proper grammar
    m ='iface eth0 inet static\s+'
    if not m:
        raise Exception("network_config format not recognized")

    address ='address')
    netmask ='netmask')
    broadcast ='broadcast')
    gateway ='gateway')
    dnsnameservers ='dnsnameservers').strip().split(' ')

    osutils = osutils_factory.get_os_utils()

    network_adapter_name = CONF.network_adapter
    if not network_adapter_name:
        # Get the first available one
        available_adapters = osutils.get_network_adapters()
        if not len(available_adapters):
            raise Exception("No network adapter available")
        network_adapter_name = available_adapters[0]'Configuring network adapter: \'%s\'' % network_adapter_name)

    reboot_required = osutils.set_static_network_config(
        network_adapter_name, address, netmask, broadcast,
        gateway, dnsnameservers)

... By bootstraping, nova injected a configuration data into this deployed VM like this

auto lo iface lo inet loopback

auto eth0 iface eth0 inet static address 172.16.x.x netmask broadcast 172.16.x.x gateway 172.16.x.x dns-nameservers 172.16.x.x

auto eth1 iface eth1 inet static address 192.168.x.x netmask broadcast 192.168.x.x gateway 192.168.x.x

So, as you can see, the eth1 is not in the eyes of cloudbase-init, so the IP is not set for eth1, cloudbase-init will take per default an IP in range 169.254.x.x for the second NIC via DHCP.

  1. Could networkconfig plugin be changed in a better way so that it can handle 2 NICs or general several NICs
  2. In getnetworkadapters() method, a SQL statement is invoked. Why is the first net adapter in the return list chosen for assigning the IP?

Thanks in advance for your help!

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted

answered 2016-03-06 20:20:49 +0300

tictoc gravatar image

Has this been resolved in newer release or is it still WIP?

edit flag offensive delete link more


The static networking code has been improved already since a few months, supporting multiple nics and a better matching between nics and metadata configuration.

alexpilotti gravatar imagealexpilotti ( 2016-03-08 10:41:46 +0300 )edit

answered 2014-11-14 12:07:43 +0300

alexpilotti gravatar image

We worked on a pull request: but the original submitter didn't follow up on the latest reviews, so this is still WiP.

Most of the OpenStack use cases involve DHCP, but this feature is still on the TODO list.

edit flag offensive delete link more

answered 2014-11-14 17:02:04 +0300

Hoang gravatar image

Hi Alessandro,

many thanks for your quick response! Are there any chances that cloudbase will take this feature into the next version fast? If not, can you show me how can I do a patch for this? (a complete msi installation with the new feature)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower


Asked: 2014-11-14 11:06:57 +0300

Seen: 372 times

Last updated: Mar 06 '16