add region_name in get neutron client to support multi-region scene
kuryr should support neutron client in multi-region scene as follows: https://bugs.launchpad.net/kuryr/+bug/1831684 Closes-Bug: 1831684 Change-Id: I91315885a56c5cfb313b73b1eddc3935bc200c6c
This commit is contained in:
parent
b10acd57ea
commit
50da6c1b30
|
@ -55,6 +55,9 @@ neutron_opts = [
|
|||
cfg.IntOpt('vif_plugging_timeout',
|
||||
default=0,
|
||||
help=_("Seconds to wait for port to become active")),
|
||||
cfg.StrOpt('region_name',
|
||||
default='RegionOne',
|
||||
help=_('Region name of the neturon endpoint to use.')),
|
||||
cfg.StrOpt('endpoint_type',
|
||||
default='public',
|
||||
choices=['public', 'admin', 'internal'],
|
||||
|
|
|
@ -40,10 +40,12 @@ def get_neutron_client(*args, **kwargs):
|
|||
auth_plugin = get_auth_plugin(conf_group)
|
||||
session = get_keystone_session(conf_group, auth_plugin)
|
||||
endpoint_type = getattr(getattr(cfg.CONF, conf_group), 'endpoint_type')
|
||||
region_name = getattr(getattr(cfg.CONF, conf_group), 'region_name')
|
||||
|
||||
return client.Client(session=session,
|
||||
auth=auth_plugin,
|
||||
endpoint_type=endpoint_type)
|
||||
endpoint_type=endpoint_type,
|
||||
region_name=region_name)
|
||||
|
||||
|
||||
def get_hostname():
|
||||
|
|
|
@ -73,7 +73,8 @@ class TestKuryrUtils(base.TestCase):
|
|||
mock_client.assert_called_once_with(
|
||||
auth=fake_auth,
|
||||
session=fake_session,
|
||||
endpoint_type=neutron_group.endpoint_type)
|
||||
endpoint_type=neutron_group.endpoint_type,
|
||||
region_name=neutron_group.region_name)
|
||||
|
||||
@mock.patch.object(socket, 'gethostname', return_value='fake_hostname')
|
||||
def test_get_hostname(self, mock_get_hostname):
|
||||
|
|
Loading…
Reference in New Issue