Merge "Add posibilities to set default timeouts"

This commit is contained in:
Zuul 2018-10-24 11:57:43 +00:00 committed by Gerrit Code Review
commit 47b24d7669
4 changed files with 45 additions and 16 deletions

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from wsme import types as wtypes
from octavia.api.common import types
@ -19,6 +20,9 @@ from octavia.api.v2.types import l7policy
from octavia.api.v2.types import pool
from octavia.common import constants
CONF = cfg.CONF
CONF.import_group('haproxy_amphora', 'octavia.common.config')
class BaseListenerType(types.BaseType):
_type_to_model_map = {'admin_state_up': 'enabled',
@ -116,19 +120,19 @@ class ListenerPOST(BaseListenerType):
timeout_client_data = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_CLIENT_DATA)
default=CONF.haproxy_amphora.timeout_client_data)
timeout_member_connect = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_MEMBER_CONNECT)
default=CONF.haproxy_amphora.timeout_member_connect)
timeout_member_data = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_MEMBER_DATA)
default=CONF.haproxy_amphora.timeout_member_data)
timeout_tcp_inspect = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_TCP_INSPECT)
default=CONF.haproxy_amphora.timeout_tcp_inspect)
class ListenerRootPOST(types.BaseType):
@ -189,19 +193,19 @@ class ListenerSingleCreate(BaseListenerType):
timeout_client_data = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_CLIENT_DATA)
default=CONF.haproxy_amphora.timeout_client_data)
timeout_member_connect = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_MEMBER_CONNECT)
default=CONF.haproxy_amphora.timeout_member_connect)
timeout_member_data = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_MEMBER_DATA)
default=CONF.haproxy_amphora.timeout_member_data)
timeout_tcp_inspect = wtypes.wsattr(
wtypes.IntegerType(minimum=constants.MIN_TIMEOUT,
maximum=constants.MAX_TIMEOUT),
default=constants.DEFAULT_TIMEOUT_TCP_INSPECT)
default=CONF.haproxy_amphora.timeout_tcp_inspect)
class ListenerStatusResponse(BaseListenerType):

View File

@ -284,6 +284,18 @@ haproxy_amphora_opts = [
cfg.FloatOpt('rest_request_read_timeout', default=60,
help=_("The time in seconds to wait for a REST API "
"response.")),
cfg.IntOpt('timeout_client_data',
default=constants.DEFAULT_TIMEOUT_CLIENT_DATA,
help=_('Frontend client inactivity timeout.')),
cfg.IntOpt('timeout_member_connect',
default=constants.DEFAULT_TIMEOUT_MEMBER_CONNECT,
help=_('Backend member connection timeout.')),
cfg.IntOpt('timeout_member_data',
default=constants.DEFAULT_TIMEOUT_MEMBER_DATA,
help=_('Backend member inactivity timeout.')),
cfg.IntOpt('timeout_tcp_inspect',
default=constants.DEFAULT_TIMEOUT_TCP_INSPECT,
help=_('Time to wait for TCP packets for content inspection.')),
# REST client
cfg.StrOpt('client_cert', default='/etc/octavia/certs/client.pem',
help=_("The client certificate to talk to the agent")),

View File

@ -204,15 +204,17 @@ class JinjaTemplater(object):
'topology': listener.load_balancer.topology,
'amphorae': listener.load_balancer.amphorae,
'enabled': listener.enabled,
'timeout_client_data': (listener.timeout_client_data or
constants.DEFAULT_TIMEOUT_CLIENT_DATA),
'timeout_member_connect': (listener.timeout_member_connect or
constants.DEFAULT_TIMEOUT_MEMBER_CONNECT
),
'timeout_member_data': (listener.timeout_member_data or
constants.DEFAULT_TIMEOUT_MEMBER_DATA),
'timeout_client_data': (
listener.timeout_client_data or
CONF.haproxy_amphora.timeout_client_data),
'timeout_member_connect': (
listener.timeout_member_connect or
CONF.haproxy_amphora.timeout_member_connect),
'timeout_member_data': (
listener.timeout_member_data or
CONF.haproxy_amphora.timeout_member_data),
'timeout_tcp_inspect': (listener.timeout_tcp_inspect or
constants.DEFAULT_TIMEOUT_TCP_INSPECT),
CONF.haproxy_amphora.timeout_tcp_inspect),
}
if listener.connection_limit and listener.connection_limit > -1:
ret_value['connection_limit'] = listener.connection_limit

View File

@ -0,0 +1,11 @@
---
features:
- |
Listeners default timeouts can be set by config in section haproxy_amphora:
* `timeout_client_data`: Frontend client inactivity timeout
* `timeout_member_connect`: Backend member connection timeout
* `timeout_member_data`: Backend member inactivity timeout
* `timeout_tcp_inspect`: Time to wait for TCP packets for content inspection
The value for all of these options is expected to be in milliseconds.