From 038dc75d16fe26f45df7a498a324f2d8f95b7054 Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Mon, 9 Dec 2024 22:22:29 -0300 Subject: [PATCH] Rework dcorch audit to avoid unnecessary logs At the end of the dcorch audit process, the `sync_request` state was being updated to `requested` for the subcloud and endpoint being audited. This causes unnecessary logs and processing for dcorch. This commit enhances the logic by updating the sync_request state just for the cases in which there are sync jobs to be run. If not, the sync status will be updated to `in-sync` for that subcloud and endpoint. Test Plan: 1. PASS: Manage subclouds for the fist time post deployment. Verify that the initial sync process is working as expected. 2. PASS: Verify that during dcorch audit, if there are no sync jobs to be run, the `sync_request` field is not updated. Verify that in steady state, dcorch will send an `in-sync` update request to state every one hour. 3. PASS: Verify that during dcorch audit, if there are sync jobs, the `sync_request` field is updated to 'requested'. Also verify that in the next sync round, that subcloud/enpdoint is synchronized. 4. PASS: Unmanage and remanage a subcloud. Verify that if there are no resources to be synchronized, the status is updated to `in-sync`. 5. PASS: Unmanage and remanage a subcloud. Verify that if there are resources to be synchronized, the `sync_request` is updated to `requested` and the sync job will synchronize the resource in the next sync cycle. 6. PASS: When a subcloud transitions from offline to online, verify the same results as in tests 4 and 5. 7. PASS: Change sysadmin password on the system controller, verify that the change is propagated to the subcloud within 20 minutes. 8. PASS: Add a new openstack user in the system controller through dc proxy, verify that the change is propagated to the subcloud momentarily. Story: 2011106 Task: 51424 Change-Id: Ieb8d227992f88d3623265312bdc0cffc7a83276a Signed-off-by: Enzo Candotti --- distributedcloud/dcorch/engine/sync_thread.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/distributedcloud/dcorch/engine/sync_thread.py b/distributedcloud/dcorch/engine/sync_thread.py index b91fbf808..cb8b52b31 100644 --- a/distributedcloud/dcorch/engine/sync_thread.py +++ b/distributedcloud/dcorch/engine/sync_thread.py @@ -770,16 +770,15 @@ class SyncThread(object): LOG.exception("Unexpected error!") if not total_num_of_audit_jobs: - # todo: if we had an "unable to sync this - # subcloud/endpoint" alarm raised, then clear it - pass + self.set_sync_status(dccommon_consts.SYNC_STATUS_IN_SYNC) - db_api.subcloud_sync_update( - self.ctxt, - self.subcloud_name, - self.endpoint_type, - values={"sync_request": consts.SYNC_STATUS_REQUESTED}, - ) + else: + db_api.subcloud_sync_update( + self.ctxt, + self.subcloud_name, + self.endpoint_type, + values={"sync_request": consts.SYNC_STATUS_REQUESTED}, + ) LOG.debug( "{}: done sync audit".format(threading.currentThread().getName()),