[hopem,r=gnuoy]
Sync charmhelpers to get fix for LP 1500386
This commit is contained in:
commit
592e691b31
@ -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 = sorted(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
|
||||||
|
@ -13,3 +13,9 @@ log to syslog = {{ use_syslog }}
|
|||||||
err to syslog = {{ use_syslog }}
|
err to syslog = {{ use_syslog }}
|
||||||
clog to syslog = {{ use_syslog }}
|
clog to syslog = {{ use_syslog }}
|
||||||
|
|
||||||
|
[client]
|
||||||
|
{% if rbd_client_cache_settings -%}
|
||||||
|
{% for key, value in rbd_client_cache_settings.iteritems() -%}
|
||||||
|
{{ key }} = {{ value }}
|
||||||
|
{% endfor -%}
|
||||||
|
{%- endif %}
|
@ -54,7 +54,8 @@ from charmhelpers.contrib.storage.linux.lvm import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.network.ip import (
|
from charmhelpers.contrib.network.ip import (
|
||||||
get_ipv6_addr
|
get_ipv6_addr,
|
||||||
|
is_ipv6,
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.python.packages import (
|
from charmhelpers.contrib.python.packages import (
|
||||||
@ -519,6 +520,12 @@ def sync_db_with_multi_ipv6_addresses(database, database_user,
|
|||||||
relation_prefix=None):
|
relation_prefix=None):
|
||||||
hosts = get_ipv6_addr(dynamic_only=False)
|
hosts = get_ipv6_addr(dynamic_only=False)
|
||||||
|
|
||||||
|
if config('vip'):
|
||||||
|
vips = config('vip').split()
|
||||||
|
for vip in vips:
|
||||||
|
if vip and is_ipv6(vip):
|
||||||
|
hosts.append(vip)
|
||||||
|
|
||||||
kwargs = {'database': database,
|
kwargs = {'database': database,
|
||||||
'username': database_user,
|
'username': database_user,
|
||||||
'hostname': json.dumps(hosts)}
|
'hostname': json.dumps(hosts)}
|
||||||
|
@ -623,6 +623,38 @@ def unit_private_ip():
|
|||||||
return unit_get('private-address')
|
return unit_get('private-address')
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def storage_get(attribute="", storage_id=""):
|
||||||
|
"""Get storage attributes"""
|
||||||
|
_args = ['storage-get', '--format=json']
|
||||||
|
if storage_id:
|
||||||
|
_args.extend(('-s', storage_id))
|
||||||
|
if attribute:
|
||||||
|
_args.append(attribute)
|
||||||
|
try:
|
||||||
|
return json.loads(subprocess.check_output(_args).decode('UTF-8'))
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def storage_list(storage_name=""):
|
||||||
|
"""List the storage IDs for the unit"""
|
||||||
|
_args = ['storage-list', '--format=json']
|
||||||
|
if storage_name:
|
||||||
|
_args.append(storage_name)
|
||||||
|
try:
|
||||||
|
return json.loads(subprocess.check_output(_args).decode('UTF-8'))
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
except OSError as e:
|
||||||
|
import errno
|
||||||
|
if e.errno == errno.ENOENT:
|
||||||
|
# storage-list does not exist
|
||||||
|
return []
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
class UnregisteredHookError(Exception):
|
class UnregisteredHookError(Exception):
|
||||||
"""Raised when an undefined hook is called"""
|
"""Raised when an undefined hook is called"""
|
||||||
pass
|
pass
|
||||||
|
@ -243,10 +243,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 or br not in portmaps:
|
if not 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.
|
||||||
|
@ -752,7 +752,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
|||||||
self.log.debug('SSL is enabled @{}:{} '
|
self.log.debug('SSL is enabled @{}:{} '
|
||||||
'({})'.format(host, port, unit_name))
|
'({})'.format(host, port, unit_name))
|
||||||
return True
|
return True
|
||||||
elif not port and not conf_ssl:
|
elif not conf_ssl:
|
||||||
self.log.debug('SSL not enabled @{}:{} '
|
self.log.debug('SSL not enabled @{}:{} '
|
||||||
'({})'.format(host, port, unit_name))
|
'({})'.format(host, port, unit_name))
|
||||||
return False
|
return False
|
||||||
|
@ -42,7 +42,7 @@ class OVSPluginContextTest(CharmTestCase):
|
|||||||
mock_resolve_ports.side_effect = lambda ports: ports
|
mock_resolve_ports.side_effect = lambda ports: ports
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
charmhelpers.contrib.openstack.context.DataPortContext()(),
|
charmhelpers.contrib.openstack.context.DataPortContext()(),
|
||||||
{'br-data': 'em1'}
|
{'em1': 'br-data'}
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch('charmhelpers.contrib.openstack.context.is_phy_iface',
|
@patch('charmhelpers.contrib.openstack.context.is_phy_iface',
|
||||||
@ -64,7 +64,7 @@ class OVSPluginContextTest(CharmTestCase):
|
|||||||
get_nic_hwaddr.side_effect = lambda nic: machine_machs[nic]
|
get_nic_hwaddr.side_effect = lambda nic: machine_machs[nic]
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
charmhelpers.contrib.openstack.context.DataPortContext()(),
|
charmhelpers.contrib.openstack.context.DataPortContext()(),
|
||||||
{'br-d2': 'em1'}
|
{'em1': 'br-d2'}
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch.object(charmhelpers.contrib.openstack.context, 'config',
|
@patch.object(charmhelpers.contrib.openstack.context, 'config',
|
||||||
|
Loading…
Reference in New Issue
Block a user