Fix condition for deleting database partition

In change [1], a restore in progress check was added, however
the flag used for this is removed at the end of the restore
playbook that is executed on controller-0, causing possible
problems if agents on other nodes send a report with incomplete
information due to restore.

To resolve this, the _verify_restore_in_progress() function
was used, which queries the restore status in the database,
and is only modified when executing the "system restore-complete"
command. This way we will know that from then on the agent's
reports can be considered.

Additionally, the “system host-reinstall” command has also
been observed to cause similar issues if run on a restored system.

To prevent this from happening, another condition was added,
which checks if inv_state is "reinstalling".

[1]: https://review.opendev.org/c/starlingx/config/+/899510

Test-Plan:
  PASS: AIO-SX fresh install
  PASS: Standard fresh install
  PASS: create/modify/delete a partition in the
        controller-0/controller-1/compute-0 followed by a reboot and check the status
        with 'system host-disk-partition-list'.
  PASS: Restart of sysinv-conductor and/or sysinv-agent services
        during puppet manifest applying.
  PASS: AIO-SX Backup and Restore
  PASS: Standard Backup and Restore

Closes-Bug: 2061170

Change-Id: I6c142439c9f13dcdeb493892a5a9283f6a1e2d00
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
This commit is contained in:
Erickson Silva de Oliveira 2024-04-12 13:46:14 -03:00
parent a1aa5b93fb
commit 0c852b54fb
1 changed files with 2 additions and 1 deletions

View File

@ -5582,7 +5582,8 @@ class ConductorManager(service.PeriodicService):
host_uuids=ihost_uuid):
if db_part.device_path not in ipart_device_paths and \
not upgrade_in_progress and \
not os.path.exists(tsc.RESTORE_IN_PROGRESS_FLAG) and \
not self._verify_restore_in_progress() and \
cutils.is_inventory_config_complete(self.dbapi, forihostid) and \
db_part.status != constants.PARTITION_CREATE_ON_UNLOCK_STATUS:
self.dbapi.partition_destroy(db_part.uuid)
LOG.info("Delete DB partition stuck: %s" % str(db_part.items()))