Merge next branch

This commit is contained in:
Corey Bryant 2015-03-21 10:30:15 +00:00
commit 7b7ee25dda
8 changed files with 161 additions and 3 deletions

View File

@ -64,6 +64,13 @@ options:
type: string
default: ext_net
description: Name of the external network for floating IP addresses provided by Neutron.
network-device-mtu:
type: int
default:
description: |
The MTU size for interfaces managed by neutron. If unset or set to
0, no value will be applied. This value will be provided to
neutron-plugin-api relations.
neutron-plugin:
default: ovs
type: string
@ -82,6 +89,71 @@ options:
gre
vxlan
.
# Quota configuration settings
quota-security-group:
default: 10
type: int
description: |
Number of security groups allowed per tenant. A negative value means
unlimited.
quota-security-group-rule:
default: 100
type: int
description: |
Number of security group rules allowed per tenant. A negative value means
unlimited
quota-network:
default: 10
type: int
description: |
Number of networks allowed per tenant. A negative value means unlimited.
quota-subnet:
default: 10
type: int
description: |
Number of subnets allowed per tenant. A negative value means unlimited.
quota-port:
default: 50
type: int
description: |
Number of ports allowed per tenant. A negative value means unlimited.
quota-vip:
default: 10
type: int
description: |
Number of vips allowed per tenant. A negative value means unlimited.
quota-pool:
default: 10
type: int
description: |
Number of pools allowed per tenant. A negative value means unlimited.
quota-member:
default: -1
type: int
description: |
Number of pool members allowed per tenant. A negative value means unlimited.
The default is unlimited because a member is not a real resource consumer
on Openstack. However, on back-end, a member is a resource consumer
and that is the reason why quota is possible.
quota-health-monitors:
default: -1
type: int
description: |
Number of health monitors allowed per tenant. A negative value means
unlimited.
The default is unlimited because a health monitor is not a real resource
consumer on Openstack. However, on back-end, a member is a resource consumer
and that is the reason why quota is possible.
quota-router:
default: 10
type: int
description: |
Number of routers allowed per tenant. A negative value means unlimited.
quota-floatingip:
default: 50
type: int
description: |
Number of floating IPs allowed per tenant. A negative value means unlimited.
# HA configuration settings
vip:
type: string

View File

@ -98,6 +98,19 @@ class NeutronCCContext(context.NeutronContext):
ctxt['neutron_bind_port'] = \
determine_api_port(api_port('neutron-server'),
singlenode_mode=True)
ctxt['quota_security_group'] = config('quota-security-group')
ctxt['quota_security_group_rule'] = \
config('quota-security-group-rule')
ctxt['quota_network'] = config('quota-network')
ctxt['quota_subnet'] = config('quota-subnet')
ctxt['quota_port'] = config('quota-port')
ctxt['quota_vip'] = config('quota-vip')
ctxt['quota_pool'] = config('quota-pool')
ctxt['quota_member'] = config('quota-member')
ctxt['quota_health_monitors'] = config('quota-health-monitors')
ctxt['quota_router'] = config('quota-router')
ctxt['quota_floatingip'] = config('quota-floatingip')
for rid in relation_ids('neutron-api'):
for unit in related_units(rid):
rdata = relation_get(rid=rid, unit=unit)

View File

@ -300,6 +300,13 @@ def neutron_plugin_api_relation_joined(rid=None):
'l2-population': get_l2population(),
'overlay-network-type': get_overlay_network_type(),
}
# Provide this value to relations since it needs to be set in multiple
# places e.g. neutron.conf, nova.conf
net_dev_mtu = config('network-device-mtu')
if net_dev_mtu:
relation_data['network-device-mtu'] = net_dev_mtu
relation_set(relation_id=rid, **relation_data)

View File

@ -108,7 +108,9 @@ BASE_RESOURCE_MAP = OrderedDict([
database=config('database'),
ssl_dir=NEUTRON_CONF_DIR),
context.PostgresqlDBContext(database=config('database')),
neutron_api_context.IdentityServiceContext(),
neutron_api_context.IdentityServiceContext(
service='neutron',
service_user='neutron'),
neutron_api_context.NeutronCCContext(),
context.SyslogContext(),
context.BindHostContext(),

View File

@ -50,13 +50,26 @@ nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0
quota_driver = neutron.db.quota_db.DbQuotaDriver
{% if neutron_security_groups -%}
quota_items = network,subnet,port,security_group,security_group_rule
quota_security_group = {{ quota_security_group }}
quota_security_group_rule = {{ quota_security_group_rule }}
{% else -%}
quota_items = network,subnet,port
{% endif -%}
quota_network = {{ quota_network }}
quota_subnet = {{ quota_subnet }}
quota_port = {{ quota_port }}
quota_vip = {{ quota_vip }}
quota_pool = {{ quota_pool }}
quota_member = {{ quota_member }}
quota_health_monitors = {{ quota_health_monitors }}
quota_router = {{ quota_router }}
quota_floatingip = {{ quota_floatingip }}
[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
[keystone_authtoken]
signing_dir = /var/lib/neutron/keystone-signing
signing_dir = {{ signing_dir }}
{% if service_host -%}
service_protocol = {{ service_protocol }}
service_host = {{ service_host }}

View File

@ -50,13 +50,26 @@ nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0
quota_driver = neutron.db.quota_db.DbQuotaDriver
{% if neutron_security_groups -%}
quota_items = network,subnet,port,security_group,security_group_rule
quota_security_group = {{ quota_security_group }}
quota_security_group_rule = {{ quota_security_group_rule }}
{% else -%}
quota_items = network,subnet,port
{% endif -%}
quota_network = {{ quota_network }}
quota_subnet = {{ quota_subnet }}
quota_port = {{ quota_port }}
quota_vip = {{ quota_vip }}
quota_pool = {{ quota_pool }}
quota_member = {{ quota_member }}
quota_health_monitors = {{ quota_health_monitors }}
quota_router = {{ quota_router }}
quota_floatingip = {{ quota_floatingip }}
[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
[keystone_authtoken]
signing_dir = /var/lib/neutron/keystone-signing
signing_dir = {{ signing_dir }}
{% if service_host -%}
service_protocol = {{ service_protocol }}
service_host = {{ service_host }}

View File

@ -157,6 +157,17 @@ class NeutronCCContextTest(CharmTestCase):
'verbose': True,
'l2_population': True,
'overlay_network_type': 'gre',
'quota_floatingip': 50,
'quota_health_monitors': -1,
'quota_member': -1,
'quota_network': 10,
'quota_pool': 10,
'quota_port': 50,
'quota_router': 10,
'quota_security_group': 10,
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
@ -175,6 +186,17 @@ class NeutronCCContextTest(CharmTestCase):
'verbose': True,
'l2_population': True,
'overlay_network_type': 'vxlan',
'quota_floatingip': 50,
'quota_health_monitors': -1,
'quota_member': -1,
'quota_network': 10,
'quota_pool': 10,
'quota_port': 50,
'quota_router': 10,
'quota_security_group': 10,
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
}
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):

View File

@ -285,6 +285,22 @@ class NeutronAPIHooksTests(CharmTestCase):
**_relation_data
)
def test_neutron_plugin_api_relation_joined_w_mtu(self):
self.test_config.set('network-device-mtu', 1500)
_relation_data = {
'neutron-security-groups': False,
'l2-population': False,
'overlay-network-type': 'vxlan',
'network-device-mtu': 1500,
}
self.get_l2population.return_value = False
self.get_overlay_network_type.return_value = 'vxlan'
self._call_hook('neutron-plugin-api-relation-joined')
self.relation_set.assert_called_with(
relation_id=None,
**_relation_data
)
def test_cluster_changed(self):
self._call_hook('cluster-relation-changed')
self.assertTrue(self.CONFIGS.write_all.called)