Relax rules when transitioning to provisioned

Relaxed the rules for stage_administrative_update() as per
recommendation in the Launchpad.

The provisioning state should have transitioned to 'provisioning' on
the host-unlock, it was observed to be still 'unprovisioned'.  This
commit makes the transition to PROVISIONED ('provisioned') less
restrictive, to also allow transition when constants.UNPROVISIONED
(not just the current constants.PROVISIONING) since the operational
state is being set to 'enabled’ (which can only be True if it is
unlocked-enabled, i.e. after provisioning).

The transition to PROVISIONING should've occured on the host-unlock
operation e.g., when following log occurs
"stage_administrative_update: provisioning"; which checks for whether
UNPROVISIONED or None there so this would align the OPERATIONAL_ENABLED
status with the PROVISIONED as well.

Closes-Bug: 1864874
Change-Id: Iaf093046dd3c315b6f22007e81b2b3f468f3e629
Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
Kristine Bujold 2020-07-06 20:55:48 -04:00
parent cb7b4757e3
commit 5ee1dc120b
2 changed files with 4 additions and 1 deletions

View File

@ -4642,7 +4642,8 @@ class HostController(rest.RestController):
if 'operational' in hostupdate.delta and \
hostupdate.ihost_patch['operational'] == \
constants.OPERATIONAL_ENABLED:
if hostupdate.ihost_orig['invprovision'] == constants.PROVISIONING:
if hostupdate.ihost_orig['invprovision'] == constants.PROVISIONING or \
hostupdate.ihost_orig['invprovision'] == constants.UNPROVISIONED:
# first time unlocked successfully
local_hostname = cutils.get_local_controller_hostname()
if (hostupdate.ihost_patch['hostname'] ==

View File

@ -2127,6 +2127,8 @@ class ConductorManager(service.PeriodicService):
pass
if ihost.invprovision not in [constants.PROVISIONED, constants.PROVISIONING]:
LOG.info("Updating %s host invprovision from %s to %s" %
(ihost.hostname, ihost.invprovision, constants.UNPROVISIONED))
value = {'invprovision': constants.UNPROVISIONED}
self.dbapi.ihost_update(ihost_uuid, value)