Enable retries when sending notifications
This patch enables retries when a connection error occurred at the time of sending a notification. This patch introduces a new config parameter v2_vnfm.notify_connect_retries that specifies the maximum number of retries. Note that the period between retries is exponential starting 0.5 seconds up to a maximum of 60 seconds. Change-Id: Ie75a7d1ec7a8dd8970b1cf58cff86f699bcc3311
This commit is contained in:
@@ -16,24 +16,28 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker._i18n import _
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
VNFM_OPTS = [
|
||||
cfg.StrOpt('endpoint',
|
||||
default='http://127.0.0.1:9890',
|
||||
help='Endpoint of VNFM (self).'),
|
||||
help=_('Endpoint of VNFM (self).')),
|
||||
cfg.IntOpt('default_graceful_termination_timeout',
|
||||
default=10,
|
||||
help='Default timeout value (second) of GRACEFUL termination.'),
|
||||
help=_('Default timeout value (second) of GRACEFUL '
|
||||
'termination.')),
|
||||
cfg.IntOpt('max_content_length',
|
||||
default=1000000,
|
||||
help='Max content length for list APIs.'),
|
||||
help=_('Max content length for list APIs.')),
|
||||
cfg.IntOpt('openstack_vim_stack_create_timeout',
|
||||
default=20,
|
||||
help='Timeout (in minuts) of heat stack creation.'),
|
||||
help=_('Timeout (in minuts) of heat stack creation.')),
|
||||
cfg.IntOpt('kubernetes_vim_rsc_wait_timeout',
|
||||
default=500,
|
||||
help='Timeout (second) of k8s res creation.'),
|
||||
help=_('Timeout (second) of k8s res creation.')),
|
||||
cfg.IntOpt('vnf_instance_page_size',
|
||||
default=0, # 0 means no paging
|
||||
help=_('Paged response size of the query result '
|
||||
@@ -46,6 +50,12 @@ VNFM_OPTS = [
|
||||
default=0, # 0 means no paging
|
||||
help=_('Paged response size of the query result '
|
||||
'for VNF LCM operation occurrences.')),
|
||||
cfg.IntOpt('notify_connect_retries',
|
||||
default=0, # 0 means no retry
|
||||
help=_('Number of retries that should be attempted for '
|
||||
'connection error when sending a notification. '
|
||||
'Period between retries is exponential starting '
|
||||
'0.5 seconds up to a maximum of 60 seconds.')),
|
||||
# NOTE: This is for test use since it is convenient to be able to delete
|
||||
# under development.
|
||||
cfg.BoolOpt('test_enable_lcm_op_occ_delete',
|
||||
@@ -63,32 +73,33 @@ NFVO_OPTS = [
|
||||
'use internal NFVO in tacker if False')),
|
||||
cfg.StrOpt('grant_api_version',
|
||||
default='1.4.0', # SOL003 v3.3.1 9.1a
|
||||
help='Grant api_version of NFVO.'),
|
||||
help=_('Grant api_version of NFVO.')),
|
||||
cfg.StrOpt('vnfpkgm_api_version',
|
||||
default='2.1.0', # SOL003 v3.3.1 10.1a
|
||||
help='Vnf package management api_version of NFVO.'),
|
||||
help=_('Vnf package management api_version of NFVO.')),
|
||||
# The following four parameters are for external NFVO.
|
||||
# Must be set when using external NFVO.
|
||||
# NOTE: It is assumed the VNFM communicates only one NFVO. That is
|
||||
# the same NFVO provides both the grant and vnf package management APIs.
|
||||
cfg.StrOpt('endpoint',
|
||||
default='',
|
||||
help='Endpoint of external NFVO.'),
|
||||
help=_('Endpoint of external NFVO.')),
|
||||
cfg.StrOpt('token_endpoint',
|
||||
default='',
|
||||
help='Token endpoint for OAuth2.0 authentication.'),
|
||||
help=_('Token endpoint for OAuth2.0 authentication.')),
|
||||
cfg.StrOpt('client_id',
|
||||
default='',
|
||||
help='Client id used by OAuth2.0 authentication.'),
|
||||
help=_('Client id used by OAuth2.0 authentication.')),
|
||||
cfg.StrOpt('client_password',
|
||||
default='',
|
||||
help='Client password used by OAuth2.0 authentication.'),
|
||||
help=_('Client password used by OAuth2.0 authentication.')),
|
||||
cfg.BoolOpt('test_callback_uri',
|
||||
default=True,
|
||||
help='Check to get notification from callback Uri.'),
|
||||
help=_('Check to get notification from callback Uri.')),
|
||||
cfg.ListOpt('test_grant_zone_list',
|
||||
default=["nova"],
|
||||
help='Zones used for test which returned in Grant response.')
|
||||
help=_('Zones used for test which returned in Grant '
|
||||
'response.'))
|
||||
]
|
||||
|
||||
CONF.register_opts(NFVO_OPTS, 'v2_nfvo')
|
||||
|
@@ -76,8 +76,11 @@ def async_call(func):
|
||||
@async_call
|
||||
def send_notification(subsc, notif_data):
|
||||
auth_handle = _get_notification_auth_handle(subsc)
|
||||
connect_retries = (CONF.v2_vnfm.notify_connect_retries
|
||||
if CONF.v2_vnfm.notify_connect_retries else None)
|
||||
client = http_client.HttpClient(auth_handle,
|
||||
version=api_version.CURRENT_VERSION)
|
||||
version=api_version.CURRENT_VERSION,
|
||||
connect_retries=connect_retries)
|
||||
|
||||
url = subsc.callbackUri
|
||||
try:
|
||||
|
Reference in New Issue
Block a user