Fixes interfaces template identification issue
When using networks without DHCP enabled and "flat_injected" set to True, the interfaces template is injected in the associated instances or included in the config drive metadata. The template includes the interface name, based on a progressive numbering (eth0, eth1, etc). In case of multiple nics, there's no clear way to identify the interfaces in the guest OS if the actual interface naming differs, this is especially valid for Windows instances. Since the MAC address (hardware address) assigned to each vNIC identifies uniquely the interface, providing the mac address during the template generation solves the issue. Change-Id: Id82db6d83caedf0e95f882d909b77ea9b98b2547 Closes-Bug: #1400080
This commit is contained in:
parent
5ef07cc04d
commit
577174b025
@ -582,6 +582,7 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
@ -604,6 +605,7 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
@ -625,6 +627,7 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
@ -646,12 +649,14 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
gateway 10.10.0.1
|
||||
dns-nameservers 1.2.3.4 2.3.4.5
|
||||
iface eth0 inet6 static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 1234:567::2
|
||||
netmask 48
|
||||
gateway 1234:567::1
|
||||
@ -673,11 +678,13 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
dns-nameservers 1.2.3.4 2.3.4.5
|
||||
iface eth0 inet6 static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 1234:567::2
|
||||
netmask 48
|
||||
dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
|
||||
@ -704,12 +711,14 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
gateway 10.10.0.1
|
||||
dns-nameservers 1.2.3.4 2.3.4.5
|
||||
iface eth0 inet6 static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 1234:567::2
|
||||
netmask 48
|
||||
gateway 1234:567::1
|
||||
@ -717,12 +726,14 @@ iface eth0 inet6 static
|
||||
|
||||
auto eth1
|
||||
iface eth1 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
gateway 10.10.0.1
|
||||
dns-nameservers 1.2.3.4 2.3.4.5
|
||||
iface eth1 inet6 static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 1234:567::2
|
||||
netmask 48
|
||||
gateway 1234:567::1
|
||||
@ -745,6 +756,7 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
@ -755,6 +767,7 @@ iface eth0 inet static
|
||||
|
||||
auto eth1
|
||||
iface eth1 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
@ -780,6 +793,7 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
@ -788,6 +802,7 @@ iface eth0 inet static
|
||||
|
||||
auto eth1
|
||||
iface eth1 inet static
|
||||
hwaddress ether aa:aa:aa:aa:aa:aa
|
||||
address 10.10.0.2
|
||||
netmask 255.255.255.0
|
||||
broadcast 10.10.0.255
|
||||
|
@ -940,12 +940,14 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
hwaddress ether DE:AD:BE:EF:00:01
|
||||
address 192.168.1.100
|
||||
netmask 255.255.255.0
|
||||
broadcast 192.168.1.255
|
||||
gateway 192.168.1.1
|
||||
dns-nameservers 192.168.1.3 192.168.1.4
|
||||
iface eth0 inet6 static
|
||||
hwaddress ether DE:AD:BE:EF:00:01
|
||||
address 2001:db8:0:1:dcad:beff:feef:1
|
||||
netmask 64
|
||||
gateway 2001:db8:0:1::1
|
||||
|
@ -10,6 +10,7 @@ iface lo inet loopback
|
||||
|
||||
auto {{ ifc.name }}
|
||||
iface {{ ifc.name }} inet static
|
||||
hwaddress ether {{ ifc.hwaddress }}
|
||||
address {{ ifc.address }}
|
||||
netmask {{ ifc.netmask }}
|
||||
broadcast {{ ifc.broadcast }}
|
||||
@ -29,6 +30,7 @@ iface {{ ifc.name }} inet static
|
||||
{% endif %}
|
||||
{% else %}
|
||||
iface {{ ifc.name }} inet6 static
|
||||
hwaddress ether {{ ifc.hwaddress }}
|
||||
address {{ ifc.address_v6 }}
|
||||
netmask {{ ifc.netmask_v6 }}
|
||||
{% if ifc.gateway_v6 %}
|
||||
|
@ -107,6 +107,7 @@ def get_injected_network_template(network_info, use_ipv6=None, template=None,
|
||||
if not network.get_meta('injected'):
|
||||
continue
|
||||
|
||||
hwaddress = vif.get('address')
|
||||
address = None
|
||||
netmask = None
|
||||
gateway = ''
|
||||
@ -144,6 +145,7 @@ def get_injected_network_template(network_info, use_ipv6=None, template=None,
|
||||
dns_v6 = ' '.join([i['address'] for i in subnet_v6['dns']])
|
||||
|
||||
net_info = {'name': 'eth%d' % ifc_num,
|
||||
'hwaddress': hwaddress,
|
||||
'address': address,
|
||||
'netmask': netmask,
|
||||
'gateway': gateway,
|
||||
|
Loading…
Reference in New Issue
Block a user