Bug 1236219 - /usr/share/nova/interfaces.template is broken (does not render correctly) and not useful with cloud-init
/usr/share/nova/interfaces.template is broken (does not render correctly) and...
Status: CLOSED WONTFIX
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova (Show other bugs)
7.0 (Kilo)
Unspecified Unspecified
high Severity high
: ---
: 8.0 (Liberty)
Assigned To: Michal Pryc
nlevinki
: ZStream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-06-26 17:58 EDT by Lars Kellogg-Stedman
Modified: 2017-06-05 13:18 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-06-05 13:18:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lars Kellogg-Stedman 2015-06-26 17:58:45 EDT
We distribute /usr/share/nova/interfaces.template that looks like this:

DEVICE="{{ name }}"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR={{ address }}
NETMASK={{ netmask }}
BROADCAST={{ broadcast }}
GATEWAY={{ gateway }}
DNS1={{ dns }}

#if $use_ipv6
IPV6INIT=yes
IPV6ADDR={{ address_v6 }}
#end if

There are two problems here:

1. The get_injected_network_template function (in nova.virt.netutils) does not call this with top-level keys matching the ones used in the template, so all the references there (e.g., {{ name }}) expand to the empty string.  The template actually receives a top-level 'interfaces' key with a list of network interfaces to inject.  We could fix this template, but...


2. cloud-init expects a debian-ish "/etc/network/interfaces" format (see, e.g., cloudinit/distros/rhel.py).  So in fact we need a template that looks like this:

{% 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 %}

Note You need to log in before you can comment on or make changes to this bug.