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 <enzo.candotti@windriver.com>
This commit is contained in:
Enzo Candotti 2024-12-09 22:22:29 -03:00
parent c891306392
commit 038dc75d16

View File

@ -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()),