![James Parker](/assets/img/avatar_default.png)
Default TripleO deployments utilize compute domain names when looking up nova service binaries, this lookup does not work when using a compute's control plane IP address though. To allow the recent change [1] to run downstream, this commit updates how parameters are passed to the init of NovaServiceManager. The hostname is passed to NovaServiceManager instead of the IP address. During the init the compute's control plane IP address is determined and passed to its SSHClient. When NovaServiceManager attempts to access nova services, it uses the compute's provided hostname now instead of the IP address. The get_ctlplane_address() function was moved from api.compute.base to utils, since services.clients now needs to leverage this functionality as well. All test case calls of get_ctlplane_address() have been updated to use the new module path. Unit test modules test_base and test_utils were updated to reflect these changes. Lastly test cases interfacing with NovaServiceManager have been updated to store both the compute's hostname as well as it's associated control plane IP address. Originally these tests only stored the compute's control plane address. [1] https://review.opendev.org/#/c/736820/ Change-Id: I4d9330cf8abcb6ba3c0852e6ce3db732e468c6a5
52 lines
2.0 KiB
Python
52 lines
2.0 KiB
Python
# Copyright 2020 Red Hat
|
|
#
|
|
# 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
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from whitebox_tempest_plugin import exceptions
|
|
from whitebox_tempest_plugin.tests import base
|
|
from whitebox_tempest_plugin import utils
|
|
|
|
|
|
class UtilsTestCase(base.WhiteboxPluginTestCase):
|
|
|
|
def setUp(self):
|
|
super(UtilsTestCase, self).setUp()
|
|
self.flags(ctlplane_addresses={'fake-host': 'fake-ip',
|
|
'fake-host2': 'fake-ip2'},
|
|
group='whitebox')
|
|
|
|
def test_normalize_json(self):
|
|
json = {'2': [2, 3, 1],
|
|
'1': True,
|
|
'4': {'b': [2, 1],
|
|
'a': [3, 0]},
|
|
'5': [{'z': [3, 1, 0], 'y': [5, 4, 3], 'a': [6, 7, 3]}],
|
|
'3': ['b', 'a', 'z']}
|
|
self.assertEqual({'1': True,
|
|
'2': [1, 2, 3],
|
|
'3': ['a', 'b', 'z'],
|
|
'4': {'a': [0, 3],
|
|
'b': [1, 2]},
|
|
'5': [{'a': [3, 6, 7],
|
|
'y': [3, 4, 5],
|
|
'z': [0, 1, 3]}]},
|
|
utils.normalize_json(json))
|
|
|
|
def test_get_ctlplane_address(self):
|
|
self.assertEqual('fake-ip',
|
|
utils.get_ctlplane_address('fake-host'))
|
|
|
|
def test_get_ctlplane_address_keyerror(self):
|
|
self.assertRaises(exceptions.CtrlplaneAddressResolutionError,
|
|
utils.get_ctlplane_address, 'missing-id')
|