diff options
-rw-r--r-- | .mailmap | 1 | ||||
-rw-r--r-- | nova/compute/manager.py | 2 | ||||
-rw-r--r-- | nova/network/manager.py | 42 | ||||
-rw-r--r-- | nova/tests/test_compute.py | 2 | ||||
-rw-r--r-- | nova/tests/test_network.py | 4 | ||||
-rw-r--r-- | nova/virt/driver.py | 2 | ||||
-rw-r--r-- | nova/virt/libvirt/connection.py | 6 | ||||
-rw-r--r-- | nova/virt/libvirt/vif.py | 5 | ||||
-rw-r--r-- | nova/virt/xenapi/vif.py | 2 | ||||
-rw-r--r-- | nova/virt/xenapi/vmops.py | 4 | ||||
-rw-r--r-- | nova/virt/xenapi_conn.py | 2 |
11 files changed, 31 insertions, 41 deletions
@@ -14,6 +14,7 @@ <code@term.ie> <github@anarkystic.com> <code@term.ie> <termie@preciousroy.local> <corywright@gmail.com> <cory.wright@rackspace.com> +<dan@nicira.com> <danwent@dan-xs3-cs> <devin.carlen@gmail.com> <devcamcar@illian.local> <ewan.mellor@citrix.com> <emellor@silver> <itoumsn@nttdata.co.jp> <itoumsn@shayol> diff --git a/nova/compute/manager.py b/nova/compute/manager.py index da84b98cb..31627fe3b 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1316,7 +1316,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self._get_instance_nw_info(ctxt, instance_ref) # Releasing security group ingress rule. - self.driver.unfilter_instance(instance_ref, network_info=network_info) + self.driver.unfilter_instance(instance_ref, network_info) # Database updating. i_name = instance_ref.name diff --git a/nova/network/manager.py b/nova/network/manager.py index 1ce8af34e..005fa73e7 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -300,6 +300,14 @@ class NetworkManager(manager.SchedulerDependentManager): The one at a time part is to flatten the layout to help scale """ + """Constant to indicate whether this manager requires VIF to create a + bridge.""" + SHOULD_CREATE_BRIDGE = False + + """Constant to indicate whether this manager requires VIF to create a + VLAN tag.""" + SHOULD_CREATE_VLAN = False + timeout_fixed_ips = True def __init__(self, network_driver=None, *args, **kwargs): @@ -483,8 +491,8 @@ class NetworkManager(manager.SchedulerDependentManager): 'rxtx_cap': flavor['rxtx_cap'], 'dns': [network['dns']], 'ips': [ip_dict(ip) for ip in network_IPs], - 'create_bridge': self._create_bridge, - 'create_vlan': self._create_vlan} + 'should_create_bridge': self.SHOULD_CREATE_BRIDGE, + 'should_create_vlan': self.SHOULD_CREATE_VLAN} if network['cidr_v6']: info['ip6s'] = [ip6_dict()] # TODO(tr3buchet): handle ip6 routes here as well @@ -702,16 +710,6 @@ class NetworkManager(manager.SchedulerDependentManager): """Sets up network on this host.""" raise NotImplementedError() - @property - def _create_bridge(self): - """Indicate whether this manager requires VIF to create a bridge.""" - return False - - @property - def _create_vlan(self): - """Indicate whether this manager requires VIF to create a VLAN tag.""" - return False - class FlatManager(NetworkManager): """Basic network where no vlans are used. @@ -772,6 +770,8 @@ class FlatDHCPManager(FloatingIP, RPCAllocateFixedIP, NetworkManager): """ + SHOULD_CREATE_BRIDGE = True + def init_host(self): """Do any initialization that needs to be run if this is a standalone service. @@ -798,11 +798,6 @@ class FlatDHCPManager(FloatingIP, RPCAllocateFixedIP, NetworkManager): self.db.network_update(context, network_ref['id'], {'gateway_v6': gateway}) - @property - def _create_bridge(self): - """Indicate whether this manager requires VIF to create a bridge.""" - return True - class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager): """Vlan network with dhcp. @@ -819,6 +814,9 @@ class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager): """ + SHOULD_CREATE_BRIDGE = True + SHOULD_CREATE_VLAN = True + def init_host(self): """Do any initialization that needs to be run if this is a standalone service. @@ -919,13 +917,3 @@ class VlanManager(RPCAllocateFixedIP, FloatingIP, NetworkManager): """Number of reserved ips at the top of the range.""" parent_reserved = super(VlanManager, self)._top_reserved_ips return parent_reserved + FLAGS.cnt_vpn_clients - - @property - def _create_bridge(self): - """Indicate whether this manager requires VIF to create a bridge.""" - return True - - @property - def _create_vlan(self): - """Indicate whether this manager requires VIF to create a VLAN tag.""" - return True diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index b80813220..2a8f33dd3 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -828,7 +828,7 @@ class ComputeTestCase(test.TestCase): for v in i_ref['volumes']: self.compute.volume_manager.remove_compute_volume(c, v['id']) self.mox.StubOutWithMock(self.compute.driver, 'unfilter_instance') - self.compute.driver.unfilter_instance(i_ref, network_info=[]) + self.compute.driver.unfilter_instance(i_ref, []) # executing self.mox.ReplayAll() diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index fca2975de..39695a1b1 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -164,8 +164,8 @@ class FlatNetworkTestCase(test.TestCase): 'label': 'test%s' % i, 'mac': 'DE:AD:BE:EF:00:0%s' % i, 'rxtx_cap': 'DONTCARE', - 'create_vlan': False, - 'create_bridge': False} + 'should_create_vlan': False, + 'should_create_bridge': False} self.assertDictMatch(nw[1], check) check = [{'enabled': 'DONTCARE', diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 5c3130dfc..34dc5f544 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -224,7 +224,7 @@ class ComputeDriver(object): """ raise NotImplementedError() - def unfilter_instance(self, instance, network_info=None): + def unfilter_instance(self, instance, network_info): """Stop filtering instance""" raise NotImplementedError() diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index d4f547ec4..c9965185a 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -315,8 +315,8 @@ class LibvirtConnection(driver.ComputeDriver): for (network, mapping) in network_info: self.vif_driver.unplug(instance, network, mapping) except: - LOG.warning("Failed while unplugging vif of instance '%s'" % \ - instance['name']) + LOG.warning(_("Failed while unplugging vif of instance '%s'"), + instance['name']) raise def _wait_for_destroy(): @@ -1570,7 +1570,7 @@ class LibvirtConnection(driver.ComputeDriver): timer.f = wait_for_live_migration timer.start(interval=0.5, now=True) - def unfilter_instance(self, instance_ref, network_info=None): + def unfilter_instance(self, instance_ref, network_info): """See comments of same method in firewall_driver.""" self.firewall_driver.unfilter_instance(instance_ref, network_info=network_info) diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index 7fb80a5cc..aa566cc72 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -72,8 +72,9 @@ class LibvirtBridgeDriver(VIFDriver): def plug(self, instance, network, mapping): """Ensure that the bridge exists, and add VIF to it.""" - if not network.get('multi_host') and mapping.get('create_bridge'): - if mapping.get('create_vlan'): + if (not network.get('multi_host') and + mapping.get('should_create_bridge')): + if mapping.get('should_create_vlan'): LOG.debug(_('Ensuring vlan %(vlan)s and bridge %(bridge)s'), {'vlan': network['vlan'], 'bridge': network['bridge']}) diff --git a/nova/virt/xenapi/vif.py b/nova/virt/xenapi/vif.py index f5fb789ff..527602243 100644 --- a/nova/virt/xenapi/vif.py +++ b/nova/virt/xenapi/vif.py @@ -36,7 +36,7 @@ class XenAPIBridgeDriver(VIFDriver): def plug(self, xenapi_session, vm_ref, instance, device, network, network_mapping): - if network_mapping.get('create_vlan'): + if network_mapping.get('should_create_vlan'): network_ref = self.ensure_vlan_bridge(xenapi_session, network) else: network_ref = NetworkHelper.find_network_with_bridge( diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index bc47ac494..b63308f55 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -880,8 +880,8 @@ class VMOps(object): for (network, mapping) in network_info: self.vif_driver.unplug(instance, network, mapping) except: - LOG.warning("Failed while unplugging vif of instance '%s'" % \ - instance['name']) + LOG.warning(_("Failed while unplugging vif of instance '%s'"), + instance['name']) raise def _wait_with_callback(self, instance_id, task, callback): diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index 03ed2ecbe..7c355a55b 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -325,7 +325,7 @@ class XenAPIConnection(driver.ComputeDriver): """This method is supported only by libvirt.""" return - def unfilter_instance(self, instance_ref, network_info=None): + def unfilter_instance(self, instance_ref, network_info): """This method is supported only by libvirt.""" raise NotImplementedError('This method is supported only by libvirt.') |