[hopem,r=]
Sync charmhelpers to get fix for LP 1500386
This commit is contained in:
parent
68f7675e62
commit
afe2e48522
@ -1364,7 +1364,7 @@ class DataPortContext(NeutronPortContext):
|
|||||||
normalized.update({port: port for port in resolved
|
normalized.update({port: port for port in resolved
|
||||||
if port in ports})
|
if port in ports})
|
||||||
if resolved:
|
if resolved:
|
||||||
return {bridge: normalized[port] for port, bridge in
|
return {normalized[port]: bridge for port, bridge in
|
||||||
six.iteritems(portmap) if port in normalized.keys()}
|
six.iteritems(portmap) if port in normalized.keys()}
|
||||||
|
|
||||||
return None
|
return None
|
||||||
@ -1375,8 +1375,8 @@ class PhyNICMTUContext(DataPortContext):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
ctxt = {}
|
ctxt = {}
|
||||||
mappings = super(PhyNICMTUContext, self).__call__()
|
mappings = super(PhyNICMTUContext, self).__call__()
|
||||||
if mappings and mappings.values():
|
if mappings and mappings.keys():
|
||||||
ports = mappings.values()
|
ports = mappings.keys()
|
||||||
napi_settings = NeutronAPIContext()()
|
napi_settings = NeutronAPIContext()()
|
||||||
mtu = napi_settings.get('network_device_mtu')
|
mtu = napi_settings.get('network_device_mtu')
|
||||||
all_ports = set()
|
all_ports = set()
|
||||||
|
@ -310,10 +310,10 @@ def parse_bridge_mappings(mappings):
|
|||||||
def parse_data_port_mappings(mappings, default_bridge='br-data'):
|
def parse_data_port_mappings(mappings, default_bridge='br-data'):
|
||||||
"""Parse data port mappings.
|
"""Parse data port mappings.
|
||||||
|
|
||||||
Mappings must be a space-delimited list of port:bridge mappings.
|
Mappings must be a space-delimited list of bridge:port.
|
||||||
|
|
||||||
Returns dict of the form {port:bridge} where port may be an mac address or
|
Returns dict of the form {port:bridge} where ports may be mac addresses or
|
||||||
interface name.
|
interface names.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# NOTE(dosaboy): we use rvalue for key to allow multiple values to be
|
# NOTE(dosaboy): we use rvalue for key to allow multiple values to be
|
||||||
|
@ -751,11 +751,12 @@ def configure_ovs():
|
|||||||
bridgemaps = parse_bridge_mappings(config('bridge-mappings'))
|
bridgemaps = parse_bridge_mappings(config('bridge-mappings'))
|
||||||
for provider, br in bridgemaps.iteritems():
|
for provider, br in bridgemaps.iteritems():
|
||||||
add_bridge(br)
|
add_bridge(br)
|
||||||
|
if not portmaps:
|
||||||
if not portmaps or br not in portmaps:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
add_bridge_port(br, portmaps[br], promisc=True)
|
for port, _br in portmaps.iteritems():
|
||||||
|
if _br == br:
|
||||||
|
add_bridge_port(br, port, promisc=True)
|
||||||
|
|
||||||
# Ensure this runs so that mtu is applied to data-port interfaces if
|
# Ensure this runs so that mtu is applied to data-port interfaces if
|
||||||
# provided.
|
# provided.
|
||||||
|
@ -221,9 +221,10 @@ class TestQuantumUtils(CharmTestCase):
|
|||||||
call('br-ex'),
|
call('br-ex'),
|
||||||
call('br-data')
|
call('br-data')
|
||||||
])
|
])
|
||||||
self.assertTrue(self.add_bridge_port.called)
|
calls = [call('br-data', 'eth0', promisc=True)]
|
||||||
|
self.add_bridge_port.assert_has_calls(calls)
|
||||||
|
|
||||||
# Now test with bridge:port format
|
# Now test with bridge:port format and bogus bridge
|
||||||
self.test_config.set('data-port', 'br-foo:eth0')
|
self.test_config.set('data-port', 'br-foo:eth0')
|
||||||
self.add_bridge.reset_mock()
|
self.add_bridge.reset_mock()
|
||||||
self.add_bridge_port.reset_mock()
|
self.add_bridge_port.reset_mock()
|
||||||
@ -236,6 +237,21 @@ class TestQuantumUtils(CharmTestCase):
|
|||||||
# Not called since we have a bogus bridge in data-ports
|
# Not called since we have a bogus bridge in data-ports
|
||||||
self.assertFalse(self.add_bridge_port.called)
|
self.assertFalse(self.add_bridge_port.called)
|
||||||
|
|
||||||
|
# Now test with bridge:port format
|
||||||
|
self.test_config.set('bridge-mappings', 'net1:br1')
|
||||||
|
self.test_config.set('data-port', 'br1:eth0.100 br1:eth0.200')
|
||||||
|
self.add_bridge.reset_mock()
|
||||||
|
self.add_bridge_port.reset_mock()
|
||||||
|
neutron_utils.configure_ovs()
|
||||||
|
self.add_bridge.assert_has_calls([
|
||||||
|
call('br-int'),
|
||||||
|
call('br-ex'),
|
||||||
|
call('br1')
|
||||||
|
])
|
||||||
|
calls = [call('br1', 'eth0.100', promisc=True),
|
||||||
|
call('br1', 'eth0.200', promisc=True)]
|
||||||
|
self.add_bridge_port.assert_has_calls(calls)
|
||||||
|
|
||||||
@patch.object(neutron_utils, 'git_install_requested')
|
@patch.object(neutron_utils, 'git_install_requested')
|
||||||
def test_do_openstack_upgrade(self, git_requested):
|
def test_do_openstack_upgrade(self, git_requested):
|
||||||
git_requested.return_value = False
|
git_requested.return_value = False
|
||||||
|
Loading…
Reference in New Issue
Block a user