Merge "Send the correct mgmt-IP to mtce"

This commit is contained in:
Zuul 2024-04-17 14:00:47 +00:00 committed by Gerrit Code Review
commit 4604cbf410
3 changed files with 21 additions and 12 deletions

View File

@ -2081,7 +2081,7 @@ class AgentManager(service.PeriodicService):
# Set ready flag for maintenance to proceed with the unlock of
# the initial controller.
utils.touch(constants.UNLOCK_READY_FLAG)
elif (os.path.isfile(tsc.MGMT_NETWORK_RECONFIGURATION_ONGOING) and
elif (os.path.isfile(tsc.MGMT_NETWORK_RECONFIGURATION_UNLOCK) and
applied_classes == ['openstack::keystone::endpoint::reconfig']):
# Set ready flag for maintenance to proceed with the unlock
# after mgmt ip reconfiguration

View File

@ -2047,6 +2047,19 @@ class HostController(rest.RestController):
"name={}, value={}. ").format(
capability, new_value))
def _get_mgmt_ip(self, hostname):
# Notify maintenance about updated mgmt_ip
# During mgmt network reconfiguration, do not change the mgmt IP
# in maintencance as it will be updated after the unlock.
if os.path.isfile(tsc.MGMT_NETWORK_RECONFIGURATION_ONGOING):
return cutils.gethostbyname(constants.CONTROLLER_0_FQDN)
else:
address_name = cutils.format_address_name(hostname,
constants.NETWORK_TYPE_MGMT)
address = utils.get_primary_address_by_name(address_name,
constants.NETWORK_TYPE_MGMT, True)
return address.address
def _patch(self, uuid, patch):
log_start = cutils.timestamped("ihost_patch_start")
@ -2299,16 +2312,7 @@ class HostController(rest.RestController):
ihost_obj['uuid'], {'capabilities': ihost_obj['capabilities']})
# Notify maintenance about updated mgmt_ip
# During mgmt network reconfiguration, do not change the mgmt IP
# in maintencance as it will be updated after the unlock.
if os.path.isfile(tsc.MGMT_NETWORK_RECONFIGURATION_ONGOING):
ihost_obj['mgmt_ip'] = cutils.gethostbyname(constants.CONTROLLER_0_FQDN)
else:
address_name = cutils.format_address_name(ihost_obj.hostname,
constants.NETWORK_TYPE_MGMT)
address = utils.get_primary_address_by_name(address_name,
constants.NETWORK_TYPE_MGMT, True)
ihost_obj['mgmt_ip'] = address.address
ihost_obj['mgmt_ip'] = self._get_mgmt_ip(ihost_obj.hostname)
hostupdate.notify_mtce = True
@ -2340,6 +2344,10 @@ class HostController(rest.RestController):
if nonmtc_change_count > 0:
LOG.info("%s Action %s perform notify_mtce" %
(hostupdate.displayid, myaction))
# Notify maintenance about updated mgmt_ip
ihost_obj['mgmt_ip'] = self._get_mgmt_ip(ihost_obj.hostname)
new_ihost_mtc = ihost_obj.as_dict()
new_ihost_mtc = cutils.removekeys_nonmtce(new_ihost_mtc)

View File

@ -2513,7 +2513,8 @@ class ConductorManager(service.PeriodicService):
if utils.config_is_reboot_required(host.config_target):
config_uuid = self._config_set_reboot_required(config_uuid)
self._puppet.update_host_config(host, config_uuid)
elif os.path.isfile(tsc.MGMT_NETWORK_RECONFIGURATION_ONGOING):
elif os.path.isfile(tsc.MGMT_NETWORK_RECONFIGURATION_UNLOCK):
# Remove unlock ready flag to prevent maintenance rebooting the
# node until the runtime manifest is finished.
try: