Add pooling support for Amphorae
Add configuration option and associated template updates to support pooling of spare Amphorae to reduce load balancer service creation time. Change-Id: Idb49b632c5728c2bbace4124897fde7369cb803e
This commit is contained in:
parent
12f73f43d1
commit
cc464bc38c
|
@ -112,3 +112,11 @@ options:
|
|||
description: |
|
||||
Restrict glance image selection to a specific owner ID. This is a
|
||||
recommended security setting.
|
||||
spare-pool-size:
|
||||
type: int
|
||||
default:
|
||||
description: |
|
||||
Number of Amphora instances to hold in the spare pool to reduce spin-up
|
||||
time for new load balancers.
|
||||
.
|
||||
The default behaviour is to not maintain any spare servers.
|
||||
|
|
|
@ -276,6 +276,22 @@ def amp_flavor_id(cls):
|
|||
leadership.leader_get('amp-flavor-id'))
|
||||
|
||||
|
||||
@charms_openstack.adapters.config_property
|
||||
def spare_amphora_pool_size(cls):
|
||||
"""Number of spare Amphora instances to pool
|
||||
|
||||
Octavia can maintain a pool of Amphora instance to reduce the spin up
|
||||
time for new loadbalancer services.
|
||||
|
||||
:param cls: charms_openstack.adapters.ConfigurationAdapter derived class
|
||||
instance. Charm class instance is at cls.charm_instance.
|
||||
:type: cls: charms_openstack.adapters.ConfiguartionAdapter
|
||||
:returns: Number of amphora instances to pool.
|
||||
:rtype: str
|
||||
"""
|
||||
return ch_core.hookenv.config('spare-pool-size')
|
||||
|
||||
|
||||
class OctaviaCharm(charms_openstack.charm.HAOpenStackCharm):
|
||||
"""Charm class for the Octavia charm."""
|
||||
# layer-openstack-api uses service_type as service name in endpoint catalog
|
||||
|
|
|
@ -10,6 +10,10 @@ controller_ip_port_list = {{ options.controller_ip_port_list }}
|
|||
{% endif -%}
|
||||
heartbeat_key = {{ options.heartbeat_key }}
|
||||
|
||||
[house_keeping]
|
||||
{% if options.spare_amphora_pool_size -%}
|
||||
spare_amphora_pool_size = {{ options.spare_amphora_pool_size }}
|
||||
{% endif %}
|
||||
|
||||
[controller_worker]
|
||||
{% if options.amp_image_owner_id -%}
|
||||
|
|
|
@ -109,6 +109,15 @@ class TestOctaviaCharmConfigProperties(Helper):
|
|||
octavia.amp_boot_network_list(cls)
|
||||
self.leader_get.assert_called_with('amp-boot-network-list')
|
||||
|
||||
def test_spare_amphora_pool_size(self):
|
||||
cls = mock.MagicMock()
|
||||
self.patch('charmhelpers.core.hookenv.config', 'config')
|
||||
self.config.return_value = None
|
||||
self.assertEqual(octavia.spare_amphora_pool_size(cls), None)
|
||||
self.config.return_value = 5
|
||||
self.assertEqual(octavia.spare_amphora_pool_size(cls), 5)
|
||||
self.config.assert_called_with('spare-pool-size')
|
||||
|
||||
|
||||
class TestOctaviaCharm(Helper):
|
||||
|
||||
|
|
Loading…
Reference in New Issue