Merge "Enable retries when sending notifications"
This commit is contained in:
@@ -16,24 +16,28 @@
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from tacker._i18n import _
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
VNFM_OPTS = [
|
VNFM_OPTS = [
|
||||||
cfg.StrOpt('endpoint',
|
cfg.StrOpt('endpoint',
|
||||||
default='http://127.0.0.1:9890',
|
default='http://127.0.0.1:9890',
|
||||||
help='Endpoint of VNFM (self).'),
|
help=_('Endpoint of VNFM (self).')),
|
||||||
cfg.IntOpt('default_graceful_termination_timeout',
|
cfg.IntOpt('default_graceful_termination_timeout',
|
||||||
default=10,
|
default=10,
|
||||||
help='Default timeout value (second) of GRACEFUL termination.'),
|
help=_('Default timeout value (second) of GRACEFUL '
|
||||||
|
'termination.')),
|
||||||
cfg.IntOpt('max_content_length',
|
cfg.IntOpt('max_content_length',
|
||||||
default=1000000,
|
default=1000000,
|
||||||
help='Max content length for list APIs.'),
|
help=_('Max content length for list APIs.')),
|
||||||
cfg.IntOpt('openstack_vim_stack_create_timeout',
|
cfg.IntOpt('openstack_vim_stack_create_timeout',
|
||||||
default=20,
|
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',
|
cfg.IntOpt('kubernetes_vim_rsc_wait_timeout',
|
||||||
default=500,
|
default=500,
|
||||||
help='Timeout (second) of k8s res creation.'),
|
help=_('Timeout (second) of k8s res creation.')),
|
||||||
cfg.IntOpt('vnf_instance_page_size',
|
cfg.IntOpt('vnf_instance_page_size',
|
||||||
default=0, # 0 means no paging
|
default=0, # 0 means no paging
|
||||||
help=_('Paged response size of the query result '
|
help=_('Paged response size of the query result '
|
||||||
@@ -46,6 +50,12 @@ VNFM_OPTS = [
|
|||||||
default=0, # 0 means no paging
|
default=0, # 0 means no paging
|
||||||
help=_('Paged response size of the query result '
|
help=_('Paged response size of the query result '
|
||||||
'for VNF LCM operation occurrences.')),
|
'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
|
# NOTE: This is for test use since it is convenient to be able to delete
|
||||||
# under development.
|
# under development.
|
||||||
cfg.BoolOpt('test_enable_lcm_op_occ_delete',
|
cfg.BoolOpt('test_enable_lcm_op_occ_delete',
|
||||||
@@ -63,32 +73,33 @@ NFVO_OPTS = [
|
|||||||
'use internal NFVO in tacker if False')),
|
'use internal NFVO in tacker if False')),
|
||||||
cfg.StrOpt('grant_api_version',
|
cfg.StrOpt('grant_api_version',
|
||||||
default='1.4.0', # SOL003 v3.3.1 9.1a
|
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',
|
cfg.StrOpt('vnfpkgm_api_version',
|
||||||
default='2.1.0', # SOL003 v3.3.1 10.1a
|
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.
|
# The following four parameters are for external NFVO.
|
||||||
# Must be set when using external NFVO.
|
# Must be set when using external NFVO.
|
||||||
# NOTE: It is assumed the VNFM communicates only one NFVO. That is
|
# NOTE: It is assumed the VNFM communicates only one NFVO. That is
|
||||||
# the same NFVO provides both the grant and vnf package management APIs.
|
# the same NFVO provides both the grant and vnf package management APIs.
|
||||||
cfg.StrOpt('endpoint',
|
cfg.StrOpt('endpoint',
|
||||||
default='',
|
default='',
|
||||||
help='Endpoint of external NFVO.'),
|
help=_('Endpoint of external NFVO.')),
|
||||||
cfg.StrOpt('token_endpoint',
|
cfg.StrOpt('token_endpoint',
|
||||||
default='',
|
default='',
|
||||||
help='Token endpoint for OAuth2.0 authentication.'),
|
help=_('Token endpoint for OAuth2.0 authentication.')),
|
||||||
cfg.StrOpt('client_id',
|
cfg.StrOpt('client_id',
|
||||||
default='',
|
default='',
|
||||||
help='Client id used by OAuth2.0 authentication.'),
|
help=_('Client id used by OAuth2.0 authentication.')),
|
||||||
cfg.StrOpt('client_password',
|
cfg.StrOpt('client_password',
|
||||||
default='',
|
default='',
|
||||||
help='Client password used by OAuth2.0 authentication.'),
|
help=_('Client password used by OAuth2.0 authentication.')),
|
||||||
cfg.BoolOpt('test_callback_uri',
|
cfg.BoolOpt('test_callback_uri',
|
||||||
default=True,
|
default=True,
|
||||||
help='Check to get notification from callback Uri.'),
|
help=_('Check to get notification from callback Uri.')),
|
||||||
cfg.ListOpt('test_grant_zone_list',
|
cfg.ListOpt('test_grant_zone_list',
|
||||||
default=["nova"],
|
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')
|
CONF.register_opts(NFVO_OPTS, 'v2_nfvo')
|
||||||
|
@@ -76,8 +76,11 @@ def async_call(func):
|
|||||||
@async_call
|
@async_call
|
||||||
def send_notification(subsc, notif_data):
|
def send_notification(subsc, notif_data):
|
||||||
auth_handle = _get_notification_auth_handle(subsc)
|
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,
|
client = http_client.HttpClient(auth_handle,
|
||||||
version=api_version.CURRENT_VERSION)
|
version=api_version.CURRENT_VERSION,
|
||||||
|
connect_retries=connect_retries)
|
||||||
|
|
||||||
url = subsc.callbackUri
|
url = subsc.callbackUri
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user