Add i18n for logging, changed create_bridge/vlan to should_create_bridge/vlan, changed unfilter_instance's keyword param to positional, and added Dan's alternate ID to .mailmap
This commit is contained in:
parent
d06908783c
commit
348dcb39f8
1
.mailmap
1
.mailmap
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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',
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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']})
|
||||
|
@ -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(
|
||||
|
@ -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):
|
||||
|
@ -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.')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user