summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-01-25 00:14:07 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2011-01-25 00:14:07 -0800
commit7bcb77277973dd80691f1c07aa66d89b7c2be150 (patch)
tree7996c47972d4ccc6ea63265e23570328e24f6c3a
parent521d872d332486e2d30a7b4cec06a3b4f3ffbe87 (diff)
parenta9bf56c7e4613c83646c109ce9e6452e0cd25d2d (diff)
merged ntt branch
-rw-r--r--nova/network/linux_net.py5
-rw-r--r--nova/utils.py14
-rw-r--r--nova/virt/libvirt.xml.template6
-rw-r--r--nova/virt/libvirt_conn.py34
4 files changed, 31 insertions, 28 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index d29e17603..c55fb66f4 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -298,10 +298,9 @@ interface %s
% pid, check_exit_code=False)
if conffile in out:
try:
- _execute('sudo kill -HUP %d' % pid)
- return
+ _execute('sudo kill %d' % pid)
except Exception as exc: # pylint: disable-msg=W0703
- LOG.debug(_("Hupping radvd threw %s"), exc)
+ LOG.debug(_("killing radvd threw %s"), exc)
else:
LOG.debug(_("Pid %d is stale, relaunching radvd"), pid)
command = _ra_cmd(network_ref)
diff --git a/nova/utils.py b/nova/utils.py
index 6d3ddd092..108824143 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -206,19 +206,17 @@ def last_octet(address):
def get_my_linklocal(interface):
try:
if_str = execute("ip -f inet6 -o addr show %s" % interface)
- condition = "\s+inet6\s+([0-9a-f:]+/\d+)\s+scope\s+link"
+ condition = "\s+inet6\s+([0-9a-f:]+)/\d+\s+scope\s+link"
links = [re.search(condition, x) for x in if_str[0].split('\n')]
address = [w.group(1) for w in links if w is not None]
if address[0] is not None:
return address[0]
else:
- return 'fe00::'
- except IndexError as ex:
- LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex)
- except ProcessExecutionError as ex:
- LOG.warn(_("Couldn't get Link Local IP of %s :%s"), interface, ex)
- except:
- return 'fe00::'
+ raise exception.Error(_("Link Local address is not found.:%s")
+ % if_str)
+ except Exception as ex:
+ raise exception.Error(_("Couldn't get Link Local IP of %s :%s")
+ % (interface, ex))
def to_global_ipv6(prefix, mac):
diff --git a/nova/virt/libvirt.xml.template b/nova/virt/libvirt.xml.template
index 8139c3620..88bfbc668 100644
--- a/nova/virt/libvirt.xml.template
+++ b/nova/virt/libvirt.xml.template
@@ -75,11 +75,13 @@
<!-- <model type='virtio'/> CANT RUN virtio network right now -->
<filterref filter="nova-instance-${name}">
<parameter name="IP" value="${ip_address}" />
- <parameter name="DHCPSERVER" value="${dhcp_server}" />
- <parameter name="RASERVER" value="${ra_server}" />
+ <parameter name="DHCPSERVER" value="${dhcp_server}" />
#if $getVar('extra_params', False)
${extra_params}
#end if
+#if $getVar('ra_server', False)
+ <parameter name="RASERVER" value="${ra_server}" />
+#end if
</filterref>
</interface>
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index 19a8bb6f3..36733764a 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -653,8 +653,7 @@ class LibvirtConnection(object):
# Assume that the gateway also acts as the dhcp server.
dhcp_server = network['gateway']
ra_server = network['ra_server']
- if not ra_server:
- ra_server = 'fd00::'
+
if FLAGS.allow_project_net_traffic:
if FLAGS.use_ipv6:
net, mask = _get_net_and_mask(network['cidr'])
@@ -693,11 +692,13 @@ class LibvirtConnection(object):
'mac_address': instance['mac_address'],
'ip_address': ip_address,
'dhcp_server': dhcp_server,
- 'ra_server': ra_server,
'extra_params': extra_params,
'rescue': rescue,
'local': instance_type['local_gb'],
'driver_type': driver_type}
+
+ if ra_server:
+ xml_info['ra_server'] = ra_server + "/128"
if not rescue:
if instance['kernel_id']:
xml_info['kernel'] = xml_info['basepath'] + "/kernel"
@@ -880,6 +881,11 @@ class FirewallDriver(object):
the security group."""
raise NotImplementedError()
+ def _ra_server_for_instance(self, instance):
+ network = db.network_get_by_instance(context.get_admin_context(),
+ instance['id'])
+ return network['ra_server']
+
class NWFilterFirewall(FirewallDriver):
"""
@@ -932,6 +938,10 @@ class NWFilterFirewall(FirewallDriver):
self.static_filters_configured = False
self.handle_security_groups = False
+ def apply_instance_filter(self, instance):
+ """No-op. Everything is done in prepare_instance_filter"""
+ pass
+
def _get_connection(self):
return self._libvirt_get_connection()
_conn = property(_get_connection)
@@ -1090,7 +1100,9 @@ class NWFilterFirewall(FirewallDriver):
'nova-base-ipv6',
'nova-allow-dhcp-server']
if FLAGS.use_ipv6:
- instance_secgroup_filter_children += ['nova-allow-ra-server']
+ ra_server = self._ra_server_for_instance(instance)
+ if ra_server:
+ instance_secgroup_filter_children += ['nova-allow-ra-server']
ctxt = context.get_admin_context()
@@ -1117,10 +1129,6 @@ class NWFilterFirewall(FirewallDriver):
return
- def apply_instance_filter(self, instance):
- """No-op. Everything is done in prepare_instance_filter"""
- pass
-
def refresh_security_group_rules(self, security_group_id):
return self._define_filter(
self.security_group_to_nwfilter_xml(security_group_id))
@@ -1271,8 +1279,9 @@ class IptablesFirewallDriver(FirewallDriver):
elif(ip_version == 6):
# Allow RA responses
ra_server = self._ra_server_for_instance(instance)
- our_rules += ['-A %s -s %s -p icmpv6' %
- (chain_name, ra_server)]
+ if ra_server:
+ our_rules += ['-A %s -s %s -p icmpv6' %
+ (chain_name, ra_server + "/128")]
# If nothing matches, jump to the fallback chain
our_rules += ['-A %s -j nova-fallback' % (chain_name,)]
@@ -1362,8 +1371,3 @@ class IptablesFirewallDriver(FirewallDriver):
network = db.network_get_by_instance(context.get_admin_context(),
instance['id'])
return network['gateway']
-
- def _ra_server_for_instance(self, instance):
- network = db.network_get_by_instance(context.get_admin_context(),
- instance['id'])
- return network['ra_server']