Merge "Update FmClient to accept the endpoint argument"
This commit is contained in:
commit
91a2305160
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2018-2021 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2021, 2024 Wind River Systems, Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
@ -29,14 +29,17 @@ API_VERSION = '1'
|
||||
class FmClient(base.DriverBase):
|
||||
"""Fault Management driver."""
|
||||
|
||||
def __init__(self, region, session,
|
||||
endpoint_type=dccommon_consts.KS_ENDPOINT_DEFAULT):
|
||||
def __init__(
|
||||
self, region, session, endpoint_type=dccommon_consts.KS_ENDPOINT_DEFAULT,
|
||||
endpoint=None
|
||||
):
|
||||
self.region_name = region
|
||||
try:
|
||||
self.fm = fmclient.Client(API_VERSION,
|
||||
session=session,
|
||||
region_name=region,
|
||||
endpoint_type=endpoint_type)
|
||||
endpoint_type=endpoint_type,
|
||||
endpoint=endpoint)
|
||||
except exceptions.ServiceUnavailable:
|
||||
raise
|
||||
|
||||
|
@ -346,7 +346,10 @@ class SubcloudsController(object):
|
||||
"""Get the deploy configuration insync status of the subcloud """
|
||||
detected_alarms = None
|
||||
try:
|
||||
fm_client = FmClient(subcloud_name, keystone_client.session)
|
||||
fm_client = FmClient(
|
||||
subcloud_name, keystone_client.session,
|
||||
endpoint=keystone_client.endpoint_cache.get_endpoint("fm")
|
||||
)
|
||||
detected_alarms = fm_client.get_alarms_by_id(
|
||||
FM_ALARM_ID_UNSYNCHRONIZED_RESOURCE)
|
||||
except Exception as ex:
|
||||
|
@ -362,13 +362,13 @@ class SubcloudAuditWorkerManager(manager.Manager):
|
||||
).keystone_client
|
||||
admin_session = keystone_client.session
|
||||
sysinv_client = SysinvClient(
|
||||
subcloud_region,
|
||||
admin_session,
|
||||
endpoint=endpoint_cache.build_subcloud_endpoint(
|
||||
subcloud_management_ip, "sysinv"
|
||||
),
|
||||
subcloud_region, admin_session,
|
||||
endpoint=keystone_client.endpoint_cache.get_endpoint("sysinv")
|
||||
)
|
||||
fm_client = FmClient(
|
||||
subcloud_region, admin_session,
|
||||
endpoint=keystone_client.endpoint_cache.get_endpoint("fm")
|
||||
)
|
||||
fm_client = FmClient(subcloud_region, admin_session)
|
||||
except keystone_exceptions.ConnectTimeout:
|
||||
if avail_status_current == dccommon_consts.AVAILABILITY_OFFLINE:
|
||||
LOG.debug("Identity or Platform endpoint for %s not "
|
||||
|
@ -132,7 +132,8 @@ class BaseState(object, metaclass=abc.ABCMeta):
|
||||
|
||||
def get_fm_client(self, region_name):
|
||||
keystone_client = self.get_keystone_client(region_name)
|
||||
return FmClient(region_name, keystone_client.session)
|
||||
endpoint = keystone_client.endpoint_cache.get_endpoint("fm")
|
||||
return FmClient(region_name, keystone_client.session, endpoint=endpoint)
|
||||
|
||||
def get_patching_client(self, region_name=dccommon_consts.DEFAULT_REGION_NAME):
|
||||
keystone_client = self.get_keystone_client(region_name)
|
||||
|
@ -86,7 +86,9 @@ class OpenStackDriver(object):
|
||||
self.fm_client = FmClient(
|
||||
region_name,
|
||||
self.keystone_client.session,
|
||||
endpoint_type=dccommon_consts.KS_ENDPOINT_DEFAULT)
|
||||
endpoint_type=dccommon_consts.KS_ENDPOINT_DEFAULT,
|
||||
endpoint=self.keystone_client.endpoint_cache.get_endpoint("fm")
|
||||
)
|
||||
OpenStackDriver.os_clients_dict[region_name][
|
||||
'fm'] = self.fm_client
|
||||
except Exception as exception:
|
||||
|
Loading…
Reference in New Issue
Block a user