Add RHOSP topology config options
This patch adds "rhosp" config option group and moves some overcloud related config options to that new group. Those options can be used in both overcloud nodes in the Tripleo based deployments as well as in the EDPM nodes in the "NextGen" OSP deployments. This patch deprecates old, "overcloud_* options names and "tripleo" group for those options. Additionally it also removes "podified" group as there are no config options only for the "podified" deployments for now. There is no need to deprecate this group or option which was there as those were introduced just now and not released yet at all. Related-Jira: #OSP-22166 Change-Id: I0587f85f6f5c86cf547c04c339b314720606fb74
This commit is contained in:
parent
d6327733d8
commit
155a7d355e
|
@ -57,7 +57,7 @@ class EdpmSshKeyFileFixture(tobiko.SharedFixture):
|
|||
@property
|
||||
def key_filename(self):
|
||||
return tobiko.tobiko_config_path(
|
||||
CONF.tobiko.podified.edpm_ssh_key_filename)
|
||||
CONF.tobiko.rhosp.ssh_key_filename)
|
||||
|
||||
def setup_fixture(self):
|
||||
self.setup_key_file()
|
||||
|
@ -102,11 +102,9 @@ class EdpmHostConfig(tobiko.SharedFixture):
|
|||
|
||||
def setup_fixture(self):
|
||||
if self.port is None:
|
||||
# TODO(slaweq): add config option
|
||||
self.port = 22
|
||||
self.port = CONF.tobiko.rhosp.ssh_port
|
||||
if self.username is None:
|
||||
# TODO(slaweq): add config option
|
||||
self.username = 'cloud-admin'
|
||||
self.username = CONF.tobiko.rhosp.ssh_username
|
||||
if self.key_filename is None:
|
||||
self.key_filename = self.key_file.key_filename
|
||||
|
||||
|
|
|
@ -18,7 +18,60 @@ import itertools
|
|||
from oslo_config import cfg
|
||||
|
||||
|
||||
# Group with config options common for RHOSP deployments
|
||||
# (both Tripleo and Podified)
|
||||
RHOSP_GROUP_NAME = 'rhosp'
|
||||
# Group with config options related only for Tripleo based deployments
|
||||
TRIPLEO_GROUP_NAME = 'tripleo'
|
||||
# Group with config options related only for podified (NextGen) deployments
|
||||
PODIFIED_GROUP_NAME = "podified"
|
||||
|
||||
RHOSP_OPTIONS = [
|
||||
cfg.IntOpt('ssh_port',
|
||||
default=None,
|
||||
deprecated_name='overcloud_ssh_port',
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help="TCP port of SSH server on overcloud or EDPM compute "
|
||||
"hosts"),
|
||||
cfg.StrOpt('ssh_username',
|
||||
default=None,
|
||||
deprecated_name='overcloud_ssh_username',
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help="Default username used to connect to overcloud or EDPM "
|
||||
"compute nodes"),
|
||||
cfg.StrOpt('ssh_key_filename',
|
||||
default='~/.ssh/osp_ssh_key',
|
||||
deprecated_name='overcloud_ssh_key_filename',
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help="SSH key filename used to login to Overcloud or EDPM "
|
||||
"compute nodes"),
|
||||
cfg.StrOpt('cloud_name',
|
||||
default='overcloud',
|
||||
deprecated_name='overcloud_cloud_name',
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help='cloud name to be used for loading credentials '),
|
||||
cfg.IntOpt('ip_version',
|
||||
deprecated_name='overcloud_ip_version',
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help=("Default IP address version to be used to connect to "
|
||||
"overcloud or EDPM compute nodes")),
|
||||
|
||||
cfg.StrOpt('inventory_file',
|
||||
default='.ansible/inventory/tripleo.yaml',
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help="path to where to export tripleo inventory file"),
|
||||
|
||||
cfg.BoolOpt('has_external_load_balancer',
|
||||
default=False,
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help="OSP env was done with an external load balancer"),
|
||||
|
||||
cfg.BoolOpt('ceph_rgw',
|
||||
default=False,
|
||||
deprecated_group=TRIPLEO_GROUP_NAME,
|
||||
help="whether Ceph RGW is deployed"),
|
||||
]
|
||||
|
||||
TRIPLEO_OPTIONS = [
|
||||
# Undercloud options
|
||||
cfg.StrOpt('undercloud_ssh_hostname',
|
||||
|
@ -46,65 +99,25 @@ TRIPLEO_OPTIONS = [
|
|||
help='Path to cacert file that can be used to send https '
|
||||
'request from the undercloud'),
|
||||
|
||||
# TODO(slaweq): those options may be also applicable for edpm nodes so
|
||||
# maybe we will need to rename them to use in both topologies
|
||||
# Overcloud options
|
||||
cfg.IntOpt('overcloud_ssh_port',
|
||||
default=None,
|
||||
help="TCP port of SSH server on overcloud hosts"),
|
||||
cfg.StrOpt('overcloud_ssh_username',
|
||||
default=None,
|
||||
help="Default username used to connect to overcloud nodes"),
|
||||
cfg.StrOpt('overcloud_ssh_key_filename',
|
||||
default='~/.ssh/id_overcloud',
|
||||
help="SSH key filename used to login to Overcloud nodes"),
|
||||
cfg.ListOpt('overcloud_rcfile',
|
||||
default=['~/overcloudrc', '~/qe-Cloud-0rc'],
|
||||
help="Overcloud RC filenames"),
|
||||
cfg.StrOpt('overcloud_cloud_name',
|
||||
default='overcloud',
|
||||
help='overcloud cloud name to be used for loading credentials '
|
||||
'from the overcloud clouds files'),
|
||||
cfg.IntOpt('overcloud_ip_version',
|
||||
help=("Default IP address version to be used to connect to "
|
||||
"overcloud nodes ")),
|
||||
cfg.StrOpt('overcloud_network_name',
|
||||
help="Name of network used to connect to overcloud nodes"),
|
||||
cfg.DictOpt('overcloud_groups_dict',
|
||||
help='Dictionary with the node groups corresponding to '
|
||||
'different hostname prefixes',
|
||||
default={'ctrl': 'controller', 'cmp': 'compute'}),
|
||||
|
||||
# NOTE(slaweq): same here
|
||||
# Other options
|
||||
cfg.StrOpt('inventory_file',
|
||||
default='.ansible/inventory/tripleo.yaml',
|
||||
help="path to where to export tripleo inventory file"),
|
||||
|
||||
cfg.BoolOpt('has_external_load_balancer',
|
||||
default=False,
|
||||
help="OSP env was done with an external load balancer"),
|
||||
|
||||
cfg.BoolOpt('ceph_rgw',
|
||||
default=False,
|
||||
help="whether Ceph RGW is deployed"),
|
||||
]
|
||||
|
||||
PODIFIED_GROUP_NAME = "podified"
|
||||
PODIFIED_OPTIONS = [
|
||||
cfg.StrOpt('edpm_ssh_key_filename',
|
||||
default='~/.ssh/id_podified_edpm',
|
||||
help="SSH key filename used to login to EDPM nodes"),
|
||||
]
|
||||
|
||||
|
||||
def register_tobiko_options(conf):
|
||||
conf.register_opts(group=cfg.OptGroup(RHOSP_GROUP_NAME),
|
||||
opts=RHOSP_OPTIONS)
|
||||
conf.register_opts(group=cfg.OptGroup(TRIPLEO_GROUP_NAME),
|
||||
opts=TRIPLEO_OPTIONS)
|
||||
conf.register_opts(group=cfg.OptGroup(PODIFIED_GROUP_NAME),
|
||||
opts=PODIFIED_OPTIONS)
|
||||
|
||||
|
||||
def list_options():
|
||||
return [(TRIPLEO_GROUP_NAME, itertools.chain(TRIPLEO_OPTIONS)),
|
||||
(PODIFIED_GROUP_NAME, itertools.chain(PODIFIED_OPTIONS))]
|
||||
return [(RHOSP_GROUP_NAME, itertools.chain(RHOSP_OPTIONS)),
|
||||
(TRIPLEO_GROUP_NAME, itertools.chain(TRIPLEO_OPTIONS))]
|
||||
|
|
|
@ -677,7 +677,7 @@ def remove_one_grastate_galera():
|
|||
pcs_haproxy = pacemaker.HAPROXY_RESOURCE
|
||||
pcs_galera = pacemaker.GALERA_RESOURCE
|
||||
|
||||
if not CONF.tobiko.tripleo.has_external_load_balancer:
|
||||
if not CONF.tobiko.rhosp.has_external_load_balancer:
|
||||
LOG.info(f'disable {pcs_haproxy}')
|
||||
if f"resource '{pcs_haproxy}' is not running on any node" not in \
|
||||
pacemaker.run_pcs_resource_operation(
|
||||
|
@ -711,7 +711,7 @@ def remove_one_grastate_galera():
|
|||
operation_wait=90):
|
||||
raise PcsEnableException()
|
||||
|
||||
if not CONF.tobiko.tripleo.has_external_load_balancer:
|
||||
if not CONF.tobiko.rhosp.has_external_load_balancer:
|
||||
LOG.info(f'enable {pcs_haproxy}')
|
||||
if f"resource '{pcs_haproxy}' is running on node" not in \
|
||||
pacemaker.run_pcs_resource_operation(pcs_haproxy,
|
||||
|
|
|
@ -42,7 +42,7 @@ CONF = config.CONF
|
|||
LOG = log.getLogger(__name__)
|
||||
SKIP_MESSAGE_EXTLB = ('Tests requiring a main VIP should be skipped when an '
|
||||
'external load balancer is used')
|
||||
has_external_lb = CONF.tobiko.tripleo.has_external_load_balancer
|
||||
has_external_lb = CONF.tobiko.rhosp.has_external_load_balancer
|
||||
|
||||
|
||||
def overcloud_health_checks(passive_checks_only=False,
|
||||
|
|
|
@ -95,12 +95,12 @@ class OvercloudMetalsmithApiTest(testtools.TestCase):
|
|||
self.assertIn(host_config.host, instance_ips)
|
||||
self.assertIsInstance(host_config.hostname, str)
|
||||
netaddr.IPAddress(host_config.hostname)
|
||||
self.assertEqual(CONF.tobiko.tripleo.overcloud_ssh_port,
|
||||
self.assertEqual(CONF.tobiko.rhosp.ssh_port,
|
||||
host_config.port)
|
||||
self.assertEqual(tripleo.get_overcloud_ssh_username(),
|
||||
host_config.username)
|
||||
key_filename = tobiko.tobiko_config_path(
|
||||
CONF.tobiko.tripleo.overcloud_ssh_key_filename)
|
||||
CONF.tobiko.rhosp.ssh_key_filename)
|
||||
self.assertEqual(key_filename, host_config.key_filename)
|
||||
self.assertTrue(os.path.isfile(key_filename))
|
||||
self.assertTrue(os.path.isfile(key_filename + '.pub'))
|
||||
|
|
|
@ -19,6 +19,7 @@ from tobiko.tests import unit
|
|||
|
||||
CONF = config.CONF
|
||||
TRIPLEO_CONF = CONF.tobiko.tripleo
|
||||
RHOSP_CONF = CONF.tobiko.rhosp
|
||||
|
||||
|
||||
class TripleoConfigTest(unit.TobikoUnitTest):
|
||||
|
@ -53,18 +54,21 @@ class UndercloudConfigTest(unit.TobikoUnitTest):
|
|||
|
||||
class OvercloudConfigTest(unit.TobikoUnitTest):
|
||||
|
||||
def test_overcloud_ssh_port(self):
|
||||
value = TRIPLEO_CONF.overcloud_ssh_port
|
||||
def test_overcloud_rcfile(self):
|
||||
for rcfile in TRIPLEO_CONF.overcloud_rcfile:
|
||||
self.assertIsInstance(rcfile, str)
|
||||
|
||||
|
||||
class RhospConfigTest(unit.TobikoUnitTest):
|
||||
|
||||
def test_ssh_port(self):
|
||||
value = RHOSP_CONF.ssh_port
|
||||
if value is not None:
|
||||
self.assertIsInstance(value, int)
|
||||
self.assertGreater(value, 0)
|
||||
self.assertLess(value, 2 ** 16)
|
||||
|
||||
def test_overcloud_ssh_username(self):
|
||||
value = TRIPLEO_CONF.overcloud_ssh_username
|
||||
def test_ssh_username(self):
|
||||
value = RHOSP_CONF.ssh_username
|
||||
if value is not None:
|
||||
self.assertIsInstance(value, str)
|
||||
|
||||
def test_overcloud_rcfile(self):
|
||||
for rcfile in TRIPLEO_CONF.overcloud_rcfile:
|
||||
self.assertIsInstance(rcfile, str)
|
||||
|
|
|
@ -23,6 +23,7 @@ from oslo_log import log
|
|||
from packaging import version
|
||||
|
||||
import tobiko
|
||||
from tobiko import config
|
||||
from tobiko.shell import ansible
|
||||
from tobiko.shell import sh
|
||||
from tobiko.shell import ssh
|
||||
|
@ -53,7 +54,7 @@ skip_if_missing_tripleo_ansible_inventory = \
|
|||
@functools.lru_cache()
|
||||
def get_tripleo_ansible_inventory_file() -> typing.Optional[str]:
|
||||
if _undercloud.has_undercloud():
|
||||
inventory_file = _config.get_tripleo_config().inventory_file
|
||||
inventory_file = config.CONF.tobiko.rhosp.inventory_file
|
||||
if inventory_file:
|
||||
inventory_file = tobiko.tobiko_config_path(inventory_file)
|
||||
fetch_tripleo_inventary_file(inventory_file=inventory_file)
|
||||
|
|
|
@ -154,7 +154,7 @@ def overcloud_node_ip_address(ip_version: int = None,
|
|||
**params):
|
||||
if instance is None:
|
||||
instance = find_overcloud_node(**params)
|
||||
ip_version = ip_version or CONF.tobiko.tripleo.overcloud_ip_version
|
||||
ip_version = ip_version or CONF.tobiko.rhosp.ip_version
|
||||
network_name = network_name or CONF.tobiko.tripleo.overcloud_network_name
|
||||
address = metalsmith.find_instance_ip_address(instance=instance,
|
||||
ip_version=ip_version,
|
||||
|
@ -169,8 +169,7 @@ class OvercloudSshKeyFileFixture(tobiko.SharedFixture):
|
|||
|
||||
@property
|
||||
def key_filename(self):
|
||||
return tobiko.tobiko_config_path(
|
||||
CONF.tobiko.tripleo.overcloud_ssh_key_filename)
|
||||
return tobiko.tobiko_config_path(CONF.tobiko.rhosp.ssh_key_filename)
|
||||
|
||||
def setup_fixture(self):
|
||||
self.setup_key_file()
|
||||
|
@ -235,7 +234,7 @@ class OvercloudHostConfig(tobiko.SharedFixture):
|
|||
if self.host is None:
|
||||
self.host = self.hostname
|
||||
if self.port is None:
|
||||
self.port = CONF.tobiko.tripleo.overcloud_ssh_port
|
||||
self.port = CONF.tobiko.rhosp.ssh_port
|
||||
if self.username is None:
|
||||
self.username = get_overcloud_ssh_username()
|
||||
if self.key_filename is None:
|
||||
|
@ -393,8 +392,8 @@ def check_overcloud(min_version: str = None,
|
|||
|
||||
@functools.lru_cache()
|
||||
def get_overcloud_ssh_username():
|
||||
if CONF.tobiko.tripleo.overcloud_ssh_username is not None:
|
||||
return CONF.tobiko.tripleo.overcloud_ssh_username
|
||||
if CONF.tobiko.rhosp.ssh_username is not None:
|
||||
return CONF.tobiko.rhosp.ssh_username
|
||||
|
||||
if tobiko.match_version(_undercloud.undercloud_version(),
|
||||
min_version='17.0'):
|
||||
|
@ -417,7 +416,7 @@ class OvercloudCloudsFileKeystoneCredentialsFixture(
|
|||
|
||||
@staticmethod
|
||||
def _get_default_cloud_name() -> typing.Optional[str]:
|
||||
return tobiko.tobiko_config().tripleo.overcloud_cloud_name
|
||||
return tobiko.tobiko_config().rhosp.cloud_name
|
||||
|
||||
|
||||
class OvercloudEnvironKeystoneCredentialsFixture(
|
||||
|
|
|
@ -364,7 +364,7 @@ def ceph_rgw_expected():
|
|||
"""Returns True if 'ceph_rgw' parameter in the config file is set to 'true'
|
||||
or ceph rgw containers were detected running by Tobiko.
|
||||
"""
|
||||
return CONF.tobiko.tripleo.ceph_rgw or assert_ceph_rgw_container_running()
|
||||
return CONF.tobiko.rhosp.ceph_rgw or assert_ceph_rgw_container_running()
|
||||
|
||||
|
||||
def skip_if_ceph_rgw():
|
||||
|
|
|
@ -160,7 +160,7 @@ class PacemakerResourcesStatus(object):
|
|||
return False
|
||||
|
||||
def vips_resource_healthy(self):
|
||||
if CONF.tobiko.tripleo.has_external_load_balancer:
|
||||
if CONF.tobiko.rhosp.has_external_load_balancer:
|
||||
LOG.info("external load balancer used - "
|
||||
"we can skip vips_resource sanity")
|
||||
return True
|
||||
|
@ -180,7 +180,7 @@ class PacemakerResourcesStatus(object):
|
|||
return False
|
||||
|
||||
def ha_proxy_cinder_healthy(self):
|
||||
if CONF.tobiko.tripleo.has_external_load_balancer:
|
||||
if CONF.tobiko.rhosp.has_external_load_balancer:
|
||||
LOG.info("external load balancer used "
|
||||
"- we can skip ha_proxy_resource sanity")
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue