Fix missing reboot flag for config uuid on unlock

Due to a limitation in config uuid functionality, on first unlock
of controller-0, node remains in config-out-of-date as we loose
the reboot flag.

Example output after unlock:
$ system host-show controller-0 | grep config
| config_applied | 62228cc1-e5da-4f2e-a3c3-c468e9a46fb5 |
| config_status | Config out-of-date |
| config_target | e2228cc1-e5da-4f2e-a3c3-c468e9a46fb5 |

The reboot flag is:
CONFIG_REBOOT_REQUIRED = (1 << 127)

We set config_target through sysinv and config_applied
through puppet once manifests have applied. If there the reboot
flag in config_target is set but not in config_applied we are
"Config-out-of-date".

On host-unlock or runtime manifest apply we set config_uuid in
hieradata to e.g.:
platform::config::params::config_uuid: \
   62228cc1-e5da-4f2e-a3c3-c468e9a46fb5

Then, after runtime manifest apply or after reboot, sysinv-agent
takes this value and updates config_applied.

A config uuid with the reboot flag is passed to puppet ONLY when
host is unlocked (which makes sense as this is when we do the
reboot). Runtime manifests don't pass the reboot flag to puppet
(it is a runtime, reboot flag has to remain).
So, in our case, at unlock it is correctly set but then sysinv
does a runtime manifest apply and resets it to a value w/o
the reboot flag. Therefore, the reboot flag is no longer set,
that's why even after unlock we still have Config-out-of-date.

To fix the issue we generate a new config_uuid with the reboot
flag set and we properly send it to puppet as the last operation
we attempt before reboot.

Change-Id: I12865d45f4456de81d72689f799441531a444bea
Closes-Bug: #1828271
Closes-Bug: #1829004
Closes-Bug: #1829260
Signed-off-by: Ovidiu Poncea <ovidiu.poncea@windriver.com>
This commit is contained in:
Ovidiu Poncea 2019-05-10 17:46:27 +03:00 committed by Al Bailey
parent 16df5d0680
commit 9720932899
1 changed files with 9 additions and 0 deletions

View File

@ -1309,6 +1309,7 @@ class ConductorManager(service.PeriodicService):
- Update the puppet hiera data configuration for host
- Allocates management address if none exists
- Set up PXE configuration to run installer
- Update keystone endpoint on initial controller config
:param context: request context
:param host: host object
@ -1342,6 +1343,8 @@ class ConductorManager(service.PeriodicService):
host.availability == constants.AVAILABILITY_ONLINE):
personalities = [constants.CONTROLLER]
config_uuid = self._config_update_hosts(context, personalities)
if self._config_is_reboot_required(host.config_target):
config_uuid = self._config_set_reboot_required(config_uuid)
classes = ['openstack::keystone::endpoint::runtime']
if utils.is_aio_system(self.dbapi):
classes.extend(['platform::compute::grub::runtime',
@ -1354,6 +1357,12 @@ class ConductorManager(service.PeriodicService):
self._config_apply_runtime_manifest(
context, config_uuid, config_dict, force=True)
# Regenerate config target uuid, node is going for reboot!
config_uuid = self._config_update_hosts(context, personalities)
if self._config_is_reboot_required(host.config_target):
config_uuid = self._config_set_reboot_required(config_uuid)
self._puppet.update_host_config(host, config_uuid)
def _ceph_mon_create(self, host):
if not StorageBackendConfig.has_backend(
self.dbapi,