In an OpenStack environment, cloud-init generally fetches information from the metadata service provided by Nova. It also has support for reading this information from a configuration drive, which under OpenStack means a virtual CD-ROM device attached to your instance containing the same information that would normally be available via the metadata service.

It is possible to generate your network configuration from this configuration drive, rather than relying on the DHCP server provided by your OpenStack environment. In order to do this you will need to make the following changes to your Nova configuration:

  1. You must be using a subnet that does have a DHCP server. This means that you have created it using neutron subnet-create --disable-dhcp ..., or that you disabled DHCP on an existing network using neutron net-update --disable-dhcp ....

  2. You must set flat_inject to true in /etc/nova/nova.conf. This causes Nova to embed network configuration information in the meta-data embedded on the configuration drive.

  3. You must ensure that injected_network_template in /etc/nova/nova.conf points to an appropriately formatted template.

Cloud-init expects the network configuration information to be presented in the format of a Debian /etc/network/interfaces file, even if you're using it on RHEL (or a derivative). The template is rendered using the Jinja2 template engine, and receives a top-level key called interfaces that contains a list of dictionaries, one for each interface.

A template similar to the following ought to be sufficient:

{% for interface in interfaces %}
auto {{ interface.name }}
iface {{ interface.name }} inet static
  address {{ interface.address }}
  netmask {{ interface.netmask }}
  broadcast {{ interface.broadcast }}
  gateway {{ interface.gateway }}
  dns-nameservers {{ interface.dns }}
{% endfor %}

This will directly populate /etc/network/interfaces on an Ubuntu system, or will get translated into /etc/sysconfig/network-scripts/ifcfg-eth0 on a RHEL system (a RHEL environment can only configure a single network interface using this mechanism).


Installing nova-docker on Fedora 21/RDO Juno

Fri 06 February 2015 by Lars Kellogg-Stedman Tags docker openstack nova

This post comes about indirectly by a request on IRC in #rdo for help getting nova-docker installed on Fedora 21. I ran through the process from start to finish and decided to write everything down for posterity.

Getting started

I started with the Fedora 21 Cloud Image, because I'm installing …

read more

Filtering libvirt XML in Nova

Thu 05 February 2015 by Lars Kellogg-Stedman Tags openstack nova

I saw a request from a customer float by the other day regarding the ability to filter the XML used to create Nova instances in libvirt. The customer effectively wanted to blacklist a variety of devices (and device types). The consensus seems to be "you can't do this right now …

read more

Accessing the serial console of your Nova servers

Mon 22 December 2014 by Lars Kellogg-Stedman Tags openstack nova

One of the new features available in the Juno release of OpenStack is support for serial console access to your Nova servers. This post looks into how to configure the serial console feature and then how to access the serial consoles of your Nova servers.

read more

Integrating custom code with Nova using hooks

Sat 27 September 2014 by Lars Kellogg-Stedman Tags openstack nova

Would you like to run some custom Python code when Nova creates and destroys virtual instances on your compute hosts? This is possible using Nova's support for hooks, but the existing documentation is somewhat short on examples, so I've spent some time trying to get things working.

The demo_nova_hooks repository …

read more