This commit adds the --migrate option to the subcloud unmanage command,
besides unmanaging the subcloud it also changes its deploy status to
'rehome-pending'. It should be used when unmanaging a subcloud before
the rehoming/migration operation. This new status will then be used by
cert-mon to determine when it should stop auditing an unmanaged
subcloud, to avoid certificate issues during the rehoming operation.
It's only possible to use this option when the subcloud's deploy status
is 'complete'. It's possible to manage it back in case the rehoming
operation is not going to be executed anymore; in this case the
deploy-status will be reverted back to 'complete'.
Example usage:
dcmanager subcloud unmanage --migrate subcloud1
Test Plan:
1. PASS - Unmanage a subcloud without --migrate and verify that it
still works and that cert-mon continues to audit it;
2. PASS - Manage a subcloud, verify that the operation still works as
expected;
3. PASS - Try to unmanage with --migrate when the subcloud's deploy
status is different than 'complete' and verify that it
doesn't allow it;
4. PASS - Unmanage a subcloud using the --migrate option and verify
that its deploy status changes to 'rehome-pending', all the
sync statuses change to 'unknown', and that cert-mon stops
auditing the subcloud;
5. PASS - Manage a 'rehome-pending' subcloud and verify that it
succeeds while also reverting its deploy_status to
'complete';
Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/900288
Story: 2010852
Task: 49060
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
Change-Id: I1d761c1a0ae401a11443d80df70338acb2a0a14a