Make `set_service_setting
` resilient to a no config change
Added a new parameter to ``set_service_setting``: ``cfg_change``. This flag is True by default. In a podified environment, if the flag is disabled and the config set does not modify the current one, the method won't expected the pod to be replaced. Closes-Bug: #OSPRH-10452 Change-Id: I1361ba4bcd9e755547394e823b134d615a2240b2
This commit is contained in:
parent
ea8a27a475
commit
b259c20115
@ -19,6 +19,7 @@ import os
|
|||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import typing
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
@ -397,18 +398,23 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
|||||||
# TODO(mblue): next gen computes configuration set should be done too,
|
# TODO(mblue): next gen computes configuration set should be done too,
|
||||||
# 'oc patch' for data plane would need more steps and triggers deployment
|
# 'oc patch' for data plane would need more steps and triggers deployment
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_service_setting(cls, node_type='controller',
|
def set_service_setting(cls, node_type: str = 'controller',
|
||||||
file='', service='neutron',
|
file: str = '', service: str = 'neutron',
|
||||||
section='DEFAULT', param='', value=''):
|
section: str = 'DEFAULT', param: str = '',
|
||||||
|
value: typing.Union[str, int] = '',
|
||||||
|
cfg_change: bool = True) -> None:
|
||||||
"""Set configuration for service
|
"""Set configuration for service
|
||||||
|
|
||||||
:param node_type(str): Node type for change, ex: controller/compute
|
:param node_type: Node type for change, ex: controller/compute
|
||||||
(currently only controllers).
|
(currently only controllers).
|
||||||
:param file(str): File for configuration change (except in podified).
|
:param file: File for configuration change (except in podified).
|
||||||
:param service(str): Podified service name (only podified).
|
:param service: Podified service name (only podified).
|
||||||
:param section(str): Section in the config file.
|
:param section: Section in the config file.
|
||||||
:param param(str): Parameter in section to change.
|
:param param: Parameter in section to change.
|
||||||
:param value(str): Value to set.
|
:param value: Value to set.
|
||||||
|
:param cfg_change: by default, it is always expected that the
|
||||||
|
configuration will change; in a podified environment, that implies a
|
||||||
|
pod replacement.
|
||||||
"""
|
"""
|
||||||
assert param, "'param' must be supplied"
|
assert param, "'param' must be supplied"
|
||||||
if WB_CONF.openstack_type == 'podified' and node_type != 'compute':
|
if WB_CONF.openstack_type == 'podified' and node_type != 'compute':
|
||||||
@ -444,6 +450,10 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
|||||||
LOG.debug("Set configuration command:\n%s", cmd)
|
LOG.debug("Set configuration command:\n%s", cmd)
|
||||||
output = cls.proxy_host_client.exec_command(cmd)
|
output = cls.proxy_host_client.exec_command(cmd)
|
||||||
LOG.debug("Output:\n%s", output)
|
LOG.debug("Output:\n%s", output)
|
||||||
|
if not cfg_change and '(no change)' in output:
|
||||||
|
# No config change done, no pod replacement.
|
||||||
|
return
|
||||||
|
|
||||||
# TODO(mblue): Add another check using network agent list
|
# TODO(mblue): Add another check using network agent list
|
||||||
# status with neutron api (as was in downstream code).
|
# status with neutron api (as was in downstream code).
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user