Fixes and add interface template
This commit is contained in:
@@ -125,7 +125,7 @@ def inject_data(image, key=None, net=None, partition=None, execute=None):
|
||||
# inject key file
|
||||
yield _inject_key_into_fs(key, tmpdir, execute=execute)
|
||||
if net:
|
||||
yield _inject_net_into_fs(net, tmpdir)
|
||||
yield _inject_net_into_fs(net, tmpdir, execute=execute)
|
||||
finally:
|
||||
# unmount device
|
||||
yield execute('sudo umount %s' % mapped_device)
|
||||
|
||||
18
nova/compute/interfaces.template
Normal file
18
nova/compute/interfaces.template
Normal file
@@ -0,0 +1,18 @@
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address %(address)s
|
||||
netmask %(netmask)s
|
||||
network %(network)s
|
||||
broadcast %(broadcast)s
|
||||
gateway %(gateway)s
|
||||
dns-nameservers %(dns)s
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ flags.DEFINE_string('simple_network_gateway', '192.168.0.1',
|
||||
'Broadcast for simple network')
|
||||
flags.DEFINE_string('simple_network_broadcast', '192.168.0.255',
|
||||
'Broadcast for simple network')
|
||||
flags.DEFINE_string('simple_network_dns', '8.8.8.8',
|
||||
flags.DEFINE_string('simple_network_dns', '8.8.4.4',
|
||||
'Dns for simple network')
|
||||
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
@@ -538,7 +538,7 @@ class CloudController(object):
|
||||
inst['ami_launch_index'] = num
|
||||
inst['bridge_name'] = bridge_name
|
||||
if FLAGS.simple_network:
|
||||
network.allocate_simple_ip(mac=inst['mac_address'])
|
||||
address = network.allocate_simple_ip()
|
||||
else:
|
||||
if inst['image_id'] == FLAGS.vpn_image_id:
|
||||
address = network.allocate_vpn_ip(
|
||||
@@ -579,10 +579,13 @@ class CloudController(object):
|
||||
pass
|
||||
if instance.get('private_dns_name', None):
|
||||
logging.debug("Deallocating address %s" % instance.get('private_dns_name', None))
|
||||
try:
|
||||
self.network.deallocate_ip(instance.get('private_dns_name', None))
|
||||
except Exception, _err:
|
||||
pass
|
||||
if FLAGS.simple_network:
|
||||
network.deallocate_simple_ip(instance.get('private_dns_name', None))
|
||||
else:
|
||||
try:
|
||||
self.network.deallocate_ip(instance.get('private_dns_name', None))
|
||||
except Exception, _err:
|
||||
pass
|
||||
if instance.get('node_name', 'unassigned') != 'unassigned': #It's also internal default
|
||||
rpc.cast('%s.%s' % (FLAGS.compute_topic, instance['node_name']),
|
||||
{"method": "terminate_instance",
|
||||
|
||||
Reference in New Issue
Block a user