Merge "Revert "Update conditions for oam config change and manifest apply""
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2013-2020 Wind River Systems, Inc.
|
||||
# Copyright (c) 2013-2017 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
import copy
|
||||
@@ -412,8 +412,6 @@ class OAMNetworkController(rest.RestController):
|
||||
if self._from_isystems:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
utils.check_disallow_during_upgrades()
|
||||
|
||||
rpc_extoam = objects.oam_network.get_by_uuid(pecan.request.context,
|
||||
extoam_uuid)
|
||||
|
||||
|
||||
@@ -475,30 +475,6 @@ def get_node_cgtsvg_limit(host):
|
||||
return cgtsvg_max_free_gib
|
||||
|
||||
|
||||
def check_disallow_during_upgrades():
|
||||
"""
|
||||
Check for upgrades in progress, and raise error if found.
|
||||
"""
|
||||
|
||||
# There must not already be a platform upgrade in progress
|
||||
try:
|
||||
pecan.request.dbapi.software_upgrade_get_one()
|
||||
except exception.NotFound:
|
||||
pass
|
||||
else:
|
||||
raise wsme.exc.ClientSideError(_(
|
||||
"Action rejected while a platform upgrade is in progress"))
|
||||
|
||||
# There must not already be a kubernetes upgrade in progress
|
||||
try:
|
||||
pecan.request.dbapi.kube_upgrade_get_one()
|
||||
except exception.NotFound:
|
||||
pass
|
||||
else:
|
||||
raise wsme.exc.ClientSideError(_(
|
||||
"Action rejected while a kubernetes upgrade is in progress"))
|
||||
|
||||
|
||||
def check_node_ceph_mon_growth(host, ceph_mon_gib, cgtsvg_max_free_gib):
|
||||
""" Check node for ceph_mon growth, include controller/worker/storage node,
|
||||
if check failed, raise error with msg.
|
||||
|
||||
@@ -150,6 +150,8 @@ CFS_DRBDADM_RECONFIGURED = os.path.join(
|
||||
tsc.PLATFORM_CONF_PATH, ".cfs_drbdadm_reconfigured")
|
||||
|
||||
# volatile flags
|
||||
CONFIG_CONTROLLER_ACTIVATE_FLAG = os.path.join(tsc.VOLATILE_PATH,
|
||||
".config_controller_activate")
|
||||
CONFIG_CONTROLLER_FINI_FLAG = os.path.join(tsc.VOLATILE_PATH,
|
||||
".config_controller_fini")
|
||||
CONFIG_FAIL_FLAG = os.path.join(tsc.VOLATILE_PATH, ".config_fail")
|
||||
@@ -4645,11 +4647,11 @@ class ConductorManager(service.PeriodicService):
|
||||
|
||||
if (active_host and active_host.config_target and
|
||||
active_host.config_applied == active_host.config_target):
|
||||
# active controller has applied target,
|
||||
# apply pending config if required
|
||||
oam_config_runtime_apply_file = self._get_oam_runtime_apply_file()
|
||||
if os.path.isfile(oam_config_runtime_apply_file):
|
||||
# apply oam config changes to the current active controller
|
||||
# active controller has applied target, apply pending config
|
||||
|
||||
if not os.path.isfile(CONFIG_CONTROLLER_ACTIVATE_FLAG):
|
||||
cutils.touch(CONFIG_CONTROLLER_ACTIVATE_FLAG)
|
||||
# apply keystone changes to current active controller
|
||||
personalities = [constants.CONTROLLER]
|
||||
config_uuid = self._config_update_hosts(context, personalities,
|
||||
host_uuids=[active_host.uuid])
|
||||
@@ -4662,9 +4664,6 @@ class ConductorManager(service.PeriodicService):
|
||||
self._config_apply_runtime_manifest(
|
||||
context, config_uuid, config_dict)
|
||||
|
||||
os.remove(oam_config_runtime_apply_file)
|
||||
LOG.info("oam config applied %s" % config_dict)
|
||||
|
||||
# apply filesystem config changes if all controllers at target
|
||||
standby_config_target_flipped = None
|
||||
if standby_host and standby_host.config_target:
|
||||
@@ -5944,21 +5943,6 @@ class ConductorManager(service.PeriodicService):
|
||||
self._destroy_tpm_config(context)
|
||||
self._destroy_certificates(context)
|
||||
|
||||
@staticmethod
|
||||
def _get_oam_runtime_apply_file(standby_controller=False):
|
||||
"""Get the file which indicates a runtime oam manifest apply is
|
||||
required for a controller.
|
||||
"""
|
||||
if standby_controller:
|
||||
hostname = cutils.get_mate_controller_hostname()
|
||||
else:
|
||||
hostname = cutils.get_local_controller_hostname()
|
||||
|
||||
oam_config_required_flag = os.path.join(
|
||||
tsc.CONFIG_PATH, '.oam_config_required_') + hostname
|
||||
|
||||
return oam_config_required_flag
|
||||
|
||||
def update_oam_config(self, context):
|
||||
"""Update the OAM network configuration"""
|
||||
|
||||
@@ -5969,10 +5953,6 @@ class ConductorManager(service.PeriodicService):
|
||||
self._update_hosts_file('oamcontroller', extoam.oam_floating_ip,
|
||||
active=False)
|
||||
|
||||
if utils.get_system_mode(self.dbapi) != constants.SYSTEM_MODE_SIMPLEX:
|
||||
cutils.touch(
|
||||
self._get_oam_runtime_apply_file(standby_controller=True))
|
||||
|
||||
def update_user_config(self, context):
|
||||
"""Update the user configuration"""
|
||||
LOG.info("update_user_config")
|
||||
|
||||
@@ -13,10 +13,8 @@ from six.moves import http_client
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from sysinv.common import constants
|
||||
from sysinv.tests.api import base
|
||||
from sysinv.tests.db import base as dbbase
|
||||
from sysinv.tests.db import utils as dbutils
|
||||
|
||||
|
||||
class OAMNetworkTestCase(base.FunctionalTest, dbbase.BaseHostTestCase):
|
||||
@@ -330,38 +328,6 @@ class TestPatchMixin(OAMNetworkTestCase):
|
||||
self._test_patch_fail(patch_obj, http_client.BAD_REQUEST,
|
||||
error_message)
|
||||
|
||||
def test_patch_oam_during_platform_upgrade(self):
|
||||
oam_floating_ip = self.oam_subnet[2]
|
||||
oam_c0_ip = self.oam_subnet[3]
|
||||
oam_c1_ip = self.oam_subnet[4]
|
||||
patch_obj = {
|
||||
'oam_floating_ip': str(oam_floating_ip),
|
||||
'oam_c0_ip': str(oam_c0_ip),
|
||||
'oam_c1_ip': str(oam_c1_ip),
|
||||
}
|
||||
dbutils.create_test_upgrade(
|
||||
state=constants.UPGRADE_STARTING
|
||||
)
|
||||
error_message = "Action rejected while a " \
|
||||
"platform upgrade is in progress"
|
||||
self._test_patch_fail(patch_obj, http_client.BAD_REQUEST,
|
||||
error_message)
|
||||
|
||||
def test_patch_oam_during_kubernetes_upgrade(self):
|
||||
oam_floating_ip = self.oam_subnet[2]
|
||||
oam_c0_ip = self.oam_subnet[3]
|
||||
oam_c1_ip = self.oam_subnet[4]
|
||||
patch_obj = {
|
||||
'oam_floating_ip': str(oam_floating_ip),
|
||||
'oam_c0_ip': str(oam_c0_ip),
|
||||
'oam_c1_ip': str(oam_c1_ip),
|
||||
}
|
||||
dbutils.create_test_kube_upgrade()
|
||||
error_message = "Action rejected while a " \
|
||||
"kubernetes upgrade is in progress"
|
||||
self._test_patch_fail(patch_obj, http_client.BAD_REQUEST,
|
||||
error_message)
|
||||
|
||||
|
||||
class IPv4TestDelete(TestDeleteMixin,
|
||||
OAMNetworkTestCase):
|
||||
|
||||
Reference in New Issue
Block a user