distcloud/distributedcloud/dcmanager/manager
Li Zhu 7ad78ea2ae Allow rehome related data update when subcloud migration fails
If the subcloud rehome_data contains an incorrect bootstrap-address in
site A and the user migrates the corresponding peer group to site B,
the migration would fail. Subsequently, it will have the 'rehome-failed'
deploy-status in site B and 'rehome-pending' deploy-status in site A.
Then the user won't be able to update the bootstrap-address in either
site due to the following restrictions:
a) Primary site (site A) is not the current leader of the peer group;
b) Update in non-primary site (site B) is not allowed.

To fix this issue, the following changes are made:
1. In the non-primary site, if the subcloud deploy-status is
rehome-failed and the primary site is unavailable, updating
the bootstrap-values and bootstrap-address will be allowed, and the PGA
will be marked as out-of-sync.
2. Modify audit to automatically sync the rehome_data from non-primary
site to primary site if subcloud in the non-primary site is managed and
online and the PGA is out-of-sync.

Additional fix for the system_leader_id issue: When migrating SPG from
one site to another, if all of the subclouds rehome fail, the leader id
of the SPG in the target site has already been updated to the target
site's UUID. However, in the source site, the leader id is not updated
to the target UUID. The fix ensures that regardless of the migration's
success, only if the migration completes, the leader id in both sites
should be updated to the target UUID.

Test plan:
Pre-Steps: 1. Create the system peer from Site A to Site B
           2. Create System peer from Site B to Site A
           3. Create the subcloud peer group in the Site A
           4. Add a subcloud with an incorrect bootstrap-address
              to the peer group
           5. Create peer group association to associate system peer
              and subcloud peer group - Site A
           6. Check current sync status in sites A and B. Verify
              they are 'in-sync'.
           7. Run migration for the subcloud peer group from Site B.
           8. Verify 'rehome-failed' deploy-status in both sites.
PASS: Verify that the bootstrap-address can be updated in site B when
      site A is down, and the PGA sync status is set to out-of-sync
      in site B. Also, verify that the audit will sync the rehome_data
      to site A and change back the PGA to in-sync once the reattempt of
      migration is successful and site A is up.
PASS: Verify that the bootstrap-values and bootstrap-address are
      the only fields that can be updated in site B when site A is down.
PASS: Verify that the update of bootstrap-address was rejected in site B
      when site A is up.
PASS: Verify that even if all of the subclouds in an SPG experience
      rehome failures, the system_leader_id in both sites is updated to
      the target's UUID.
PASS: Verify that when site A is always online or recovered during
      the migration to site B, the subcloud deploy_status in both sites
      is "rehome-failed" after the migration completes. In this
      scenario, site A can migrate the subcloud back, even though it's
      still failed. However, after correcting the bootstrap-address in
      site A, the reattempt of migration in site A succeeds.

Closes-Bug: 2057981

Change-Id: I999dbf035e29950fd823e9cdb087160ce40fd4ca
Signed-off-by: lzhu1 <li.zhu@windriver.com>
2024-03-20 11:27:56 -04:00
..
README.rst Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
__init__.py Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
peer_group_audit_manager.py Allow rehome related data update when subcloud migration fails 2024-03-20 11:27:56 -04:00
peer_monitor_manager.py Set PGA status to out-of-sync after certain operations 2024-03-08 19:38:31 +00:00
service.py Set PGA status to out-of-sync after certain operations 2024-03-08 19:38:31 +00:00
subcloud_manager.py Fix peer-group-association sync_message 2024-03-14 12:05:55 -03:00
system_peer_manager.py Allow rehome related data update when subcloud migration fails 2024-03-20 11:27:56 -04:00

README.rst

Service

DC Manager Service has responsibility for:

Main subcloud state machine as well as all operations on subclouds including creation, deletion and update.

service.py:

run DC Manager service in multi-worker mode, and establish RPC server

subcloud_manager.py:

Manages all subcloud related activities such as creation, deletion, availability status, management state

audit_manager.py:

A Periodic audit to contact each subcloud and ensure that at least one of each service group is up and active, which is a pre-requisite for declaring a subcloud as online.

scheduler.py:

Thread group manager, also responsible for periodic timer tasks - ie. audit.