Support networks without gateway

Launching an instance when using network injection on a network
containing a subnet that has no gateway fails in scheduling with
a KeyError when using a legacy network_info provider and generates
an invalid network file for the others.

The following changes were done:

* The legacy transformer for network_info now always provides
  a gateway/gateway_v6 field, with a value of None if no gateway
  is available (this is similar to the other fields that are empty).
* The interfaces template was modified to include the gateway line
  only if a gateway is provided for the interface.

Fixes: bug #1207878
Change-Id: I887757a6bcba528059ace8831a7d23a31b08c630
This commit is contained in:
Mathieu Mitchell
2013-06-28 12:31:54 -04:00
committed by Mathieu Gagné
parent e685a72424
commit 27fc4648b7
3 changed files with 68 additions and 29 deletions

View File

@@ -13,7 +13,9 @@ iface ${ifc.name} inet static
address ${ifc.address}
netmask ${ifc.netmask}
broadcast ${ifc.broadcast}
#if $ifc.gateway
gateway ${ifc.gateway}
#end if
#if $ifc.dns
dns-nameservers ${ifc.dns}
#end if
@@ -22,7 +24,9 @@ iface ${ifc.name} inet static
iface ${ifc.name} inet6 static
address ${ifc.address_v6}
netmask ${ifc.netmask_v6}
#if $ifc.gateway_v6
gateway ${ifc.gateway_v6}
#end if
#end if
#end for