From 0c852b54fb912d3c4bf83c0a3a27fe4a70be8332 Mon Sep 17 00:00:00 2001 From: Erickson Silva de Oliveira Date: Fri, 12 Apr 2024 13:46:14 -0300 Subject: [PATCH] Fix condition for deleting database partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- sysinv/sysinv/sysinv/sysinv/conductor/manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index e6626f05e1..a4e727b327 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -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()))