Commit Graph

219 Commits

Author SHA1 Message Date
Zuul 622b38f552 Merge "Output an informative message after running out-of-sync operations" 2024-03-08 20:19:48 +00:00
Li Zhu 02444385e9 Output an informative message after running out-of-sync operations
Add a minor enhancement to GEO-redundancy. Output an informative message
after running below out-of-sync operations, informing the operator that
a sync command should be executed.
Adding subcloud(s) to the SPG.
Removing subcloud(s) from the SPG.
Updating subcloud(s) in the SPG.

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 subcloud(s) to the peer group
           5. Create peer group association to associate system peer
              and subcloud peer group - Site A
           6. Check current sync status on Sites A and B. Verify
              they are 'in-sync'.
PASS: Verify that the corresponding informative message is printed out
      after running below out-of-sync operations:
      1. Adding subcloud to the SPG.
      2. Removing subcloud from the SPG.
      3. Updating subcloud in the SPG, for example, bootstrap address,
         bootstrap values or install values.
PASS: Verify that informative message is not printed when running any
      operation on the sublcoud which does not belong to an SPG.

Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/909277

Closes-Bug: 2054124

Change-Id: I1614a719190b2645eb8139b158b0bab257d0f91d
Signed-off-by: lzhu1 <li.zhu@windriver.com>
2024-03-08 08:43:41 -05:00
Zuul 8405f3b47c Merge "Change class name to use camelCase" 2024-03-01 15:03:32 +00:00
Hugo Brito d847780a4d Fix subcloud fields update
This commit addresses the issue encountered when updating the
subcloud fields directly with a file introduced by [1]. This
caused issues because the file would be closed, making the content
inaccessible. Now, we update the fields using the file content.

An intermittent error, introduced by [2], was fixed in the
test_prestage_with_subcloud_id test.

[1]: https://review.opendev.org/c/starlingx/distcloud-client/+/909454
[2]: https://review.opendev.org/c/starlingx/distcloud-client/+/909975

Test Plan:
PASS: Create a subcloud
PASS: Update a subcloud
PASS: Create a subcloud backup
PASS: Subcloud deploy create
PASS: Subcloud deploy upload

Closes-bug: 2055446

Change-Id: Ib8b831353dba9d073131eb1c12ccd57513c63e7f
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-02-29 19:04:20 -03:00
Hugo Brito 1614a6ae75 Change class name to use camelCase
Fixed some class names that were in snake_case because
it's not right according to PEP8/PyLint. Now they're all camelCase.

Also, did a direct assignment to client_manager attributes.

Test Plan:
PASS: Run tox command.
- pylint success
- pep8 success
- py39 success
PASS: Check if all commands are working properly.

Closes-bug: 2053023

Change-Id: Iba489e23eb27015f27c6b8d5231f5d6002fa6876
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-02-29 17:10:14 -03:00
Hugo Brito a507c6449d Enable R (refactor) checkers on pylint
This commit enables the `R` (refactor) checkers in `pylint`
configuration. This will help ensure code maintainability
and adherence to best practices.

Black formatter was applied in the modified files.

Test Plan:
PASS: Execute tox command
- pylint success
- py39 success
- pep8 success

Partial-Bug: 2053023

Change-Id: I9946eaee33e4691fc212a852079ba0ca851a6ccd
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-02-28 18:30:10 +00:00
Hugo Brito b87508a410 Update tox config for Distributed Cloud Client
Cleanup the tox configuration and requirements.

Black formatter was applied in the modified files.

Test Plan:
Verify that all Tox tests pass without errors.
1. Successfully executed on the distributedcloud dir
- tox -e docs,releasenotes,api-ref,bandit,linters
- tox -e newnote -- new-note
2. Successfully executed on the distributedcloud/distributedcloud dir
- tox -e py39,pylint,pep8,cover

Partial-Bug: 2053023

Change-Id: Ib25f31f8607e46e51dfbda0a6b3a36e9e11151df
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-02-27 16:58:59 -03:00
Christopher de Oliveira Souza 0ffdaa3578 Add region_name in subcloud show parameters as default
In this commit, the dcmanager subcloud show command was updated
to display region_name as default.

Test Plan:
PASS: run dcmanager subcloud show <subcloud name> and verify that
region name is displayed
PASS: run dcmanager subcloud show <subcloud name> -d and verify that
region name is displayed

Closes-bug: 2054803

Change-Id: I4481b34a9406d84c28f0230385eee79b9cc82753
Signed-off-by: Christopher de Oliveira Souza <Christopher.DeOliveiraSouza@windriver.com>
2024-02-27 14:35:43 -03:00
Zuul 76029da32b Merge "Create software-deploy-strategy command" 2024-02-20 21:37:20 +00:00
Hugo Brito da6dcf23ba Create software-deploy-strategy command
Added a new command: dcmanager software-deploy-strategy to
manage software orchestration. This command requires
a --release-id parameter for specifying the release to deploy.

Test Plan:
1. Verify that command software-deploy-strategy create without
--release-id option fails
2. Verify that command software-deploy-strategy create --release-id
is processed successfully
3. Verify that command software-deploy-strategy show/delete/abort/apply
is processed successfully.

Story: 2010676
Task: 49548
Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/908538

Change-Id: I389bac227833b5f63e19a136d0f13b75f9fb8866
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-02-15 19:43:30 +00:00
Zuul 83f76109a7 Merge "Revert "Add the --upload-only option to dcmanager upgrade_strategy CLI"" 2024-02-07 13:24:25 +00:00
Christopher de Oliveira Souza 01fb97e87a Revert "Add the --upload-only option to dcmanager upgrade_strategy CLI"
This reverts commit f7487d291f.

Reason for revert: This change no longer will be necessary

Change-Id: I4b8b60044b95f6c5f91703274a408f4235df9f15
2024-02-07 09:49:28 -03:00
Li Zhu eb4e7eeeb0 Display prestage status and versions in subcloud list
The prestage release can be either the previous or current release for
a subcloud. Checking the prestage release individually on thousands of
subclouds is impractical. Therefore, a new column called "prestage
versions" is added to the output of the "dcmanager subcloud list'
command. Besides, decoupling prestage status from deploy status.

This commit also introduces the following changes:
- 'backup datetime' column removal and addition of 'prestage status'
  column to 'dcmanager subcloud list' output.
- 'dcmanager subcloud show' and similar commands now display 'prestage
  status' and 'prestage versions' columns in their output.
- New '-d/--detail' option is added to 'dcmanager subcloud list' to
  display all columns of the subclouds.
- '-c/--column' option of 'dcmanager subcloud list' can be used to
  specify the column(s) of the subclouds. eg. -c column1 -c column2 ...

Test plan:
PASS: Verify the correct "prestage status" and "prestage versions"
      output of the "dcmanager subcloud list" command.
PASS: Verify the correct output of the new arguments -d/--detail and
      -c/--column.

Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/904541

Story: 2010611
Task: 49369

Change-Id: I8d127220fcd705dca542afeca2ac8f19f20172a1
Signed-off-by: lzhu1 <li.zhu@windriver.com>
2024-01-24 14:39:36 +00:00
twang4 c9e03caa9d Remove subcloud migrate from CLI
This commit removes "subcloud migrate" command since
"subcloud-peer-group migrate" command can be re-executed to migrate
a single subcloud that failed to migrate in the previous attempt.

Test Plan:
PASS - Verify that "dcmanager subcloud migrate" and "dcmanager help
       subcloud migrate" return an error (dcmanager: 'subcloud migrate'
       is not a dcmanager command. See 'dcmanager --help'.)

Closes-Bug: 2049336

Change-Id: I793bee7d680d59a4d29a585c88c8c1689976ee1b
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2024-01-16 17:46:45 -03:00
Zuul c749b71531 Merge "Add 'subcloud deploy delete' command to dcmanager" 2024-01-09 13:59:49 +00:00
Swapna Gorre 93fdf78e8a Add 'subcloud deploy delete' command to dcmanager
This commit adds the subcloud deploy delete command to dcmanager client.
It's used to delete deploy files under /opt/platform/deploy.

Usage:

dcmanager subcloud deploy delete
dcmanager subcloud deploy delete --release <Release_Version>
dcmanager subcloud deploy delete --prestage-images
dcmanager subcloud deploy delete --deployment-files

Test Cases:

1) PASS: Verify the deployment files were deleted belonging to
         the specified release.
2) PASS: Verify the deployment files were deleted belonging to
         the active release when the '--release' not present.
3) PASS: Verify the prestage images list file deleted when the
         '--prestage-images' present.
4) PASS: Verify the deploy overrides, deploy chart, deploy playbook
         files deleted when '--deployment-files' present.
5) PASS: Run 'dcmanager subcloud deploy delete' and verify that the
         correct API call is made.

Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/901112

Story: 2010718
Task: 49190

Change-Id: I38961a584b5e295580eae0a5d80549732ed591c8
Signed-off-by: Swapna Gorre <swapna.gorre@windriver.com>
2024-01-08 12:01:27 -05:00
Zhang Rong(Jon) 56049f435a Add association_type for association CLI list and detail
Given that the non-primary association is automatically
generated, it is necessary to introduce a type indicator to
differentiate between primary and non-primary associations.
This commit aims to incorporate the association type when
listing and retrieving details of the association.

Test Plan:
- PASS: The command "dcmanager peer-group-association list"
        display the type information of the each association,
        indicating whether it is primary or non-primary.
- PASS: The command "dcmanager peer-group-association show"
        will include the "association_type" attribute.
- PASS: The association add/update/sync commands will include
        the association_type attribute.

Closes-Bug: 2046809
Depends-On: Ia917d0dc7c65fbea1e222fb52dbec79fdbe65b65

Change-Id: I4d55700f85956c785760b2cc0a5e2ea13a180c22
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2023-12-20 22:11:41 +08:00
Zuul cee92f4f28 Merge "Add the --upload-only option to dcmanager upgrade_strategy CLI" 2023-12-19 17:48:14 +00:00
Zhang Rong(Jon) 2c9ee0ea97 Change heartbeat-status to availablity-state of system peer
Fix availablity-state field is missing of system peer

Test Plan:
- PASS: Create/Update the system peer check the availability-
        state is exist in CLI.
- PASS: Get details of the system peer check the availability-
        state is exist in CLI.

Closes-Bug: 2045717
Depends-On: I497e3d21355c08d000a77965e6a6f36c6f483936

Change-Id: I07268732b9fab22a21e32dee8f22cc615f372461
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2023-12-06 20:22:58 +08:00
Gustavo Herzmann 9d384d63b1 Add --migrate option to subcloud unmanage
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
2023-11-08 18:43:58 -03:00
Zuul 5b00ad57ed Merge "Add peer group association API support" 2023-11-06 13:37:11 +00:00
Zhang Rong(Jon) ac38a338fb Add peer group association API support
Add dcmanager peer-group-association management CLI.

This commit add peer-group-association CMD of
add/delete/update/show/list/sync
list-subcloud-peer-groups of a system-peer

CLI example:
dcmanager peer-group-association add --peer-group-id 1
  --system-peer-id 1 --peer-group-priority 99
dcmanager peer-group-association list
dcmanager peer-group-association update --peer-group-priority 90
dcmanager peer-group-association show 1
dcmanager peer-group-association sync 1
dcmanager peer-group-association delete 1
dcmanager system-peer list-subcloud-peer-groups 1

Test Plan:
1. PASS - Create a peer-group-association and verify the successful
          creation of the peer site's subcloud-peer-group;
2. PASS - Run the add command without providing the required
          parameters. Verify that the command fails with the
          correct error message;
3. PASS - Verify that the `system-peer list-subcloud-peer-groups`
          command retrieves the expected subcloud-peer-groups;
4. PASS - Successfully update the peer-group-priority of a
          peer-group-association using the `dcmanager
          peer-group-association update` command;
5. PASS - Test `dcmanager peer-group-association sync` command and
          verify the peer site successful synchronization;
6. PASS - Test `dcmaanger peer-group-association delete` command and
          verify successful deletion;
7. PASS - Test 'dcmanager peer-group-association list' command;
8. PASS - Test 'dcmanager peer-group-association show' command;
9. PASS - Test the help output of all commands and verify its
          correctness.

Story: 2010852
Task: 48507
Depends-On: I41c16a8ab13e60f5b1de5b05fbbc51821f7f8d57
Change-Id: Ice15721c9674685a770116adad4f9a2d2ae712e0
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2023-11-03 07:49:24 +08:00
twang4 5c82ba1e6a Remove rehome_data from subcloud show
Remove rehome_data  from command:
dcmanager subcloud show SUBCLOUD

Test Plan:
PASS - dcmanager subclouds show SUBCLOUD
      can show items without rehome_data

Story: 2010852
Task: 49035

Change-Id: I62d73757196f499839c1cc9c0b8a9e616388cf7b
Signed-off-by: Wang Tao <tao.wang@windriver.com>
2023-11-02 14:01:16 +08:00
Zhang Rong(Jon) 7e2021bbe0 System peer CLI options change to choice
Change "dcmanager system-peer add --heartbeat-failure-policy
--administrative-state" to choice;
Change "dcmanager system-peer update --administrative-state" and
"dcmanager system-peer update --heartbeat-failure-policy" to
choice.

Test Plan:
1. PASS - Run 'dcmanager system-peer add --heartbeat-failure-policy
          --administrative-state' with correct choice and verify
          that the command work as expected;
2. PASS - Run 'dcmanager system-peer update --administrative-state'
          'dcmanager system-peer update --heartbeat-failure-policy'
          with correct choice and verify that the command work as
          expected;
3. PASS - Run 'dcmanager system-peer add --heartbeat-failure-policy
          --administrative-state' with wrong choice and verify
          that the error message prompted;
4. PASS - Run 'dcmanager system-peer update --administrative-state'
          'dcmanager system-peer update --heartbeat-failure-policy'
          with wrong choice and verify that the error message
          prompted;
5. PASS - Verify 'dcmanager help system-peer add' and 'dcmanager
          help system-peer update' output the correct messages.

Story: 2010852
Task: 48487

Change-Id: I626fc0ccd156224e643940d208848ba832ccf25d
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2023-10-31 13:17:38 +08:00
Zhang Rong(Jon) 59084472a5 Remove peer group add/update priority from CLI; Add heartbeat_status for
peer

Remove "dcmanager subcloud-peer-group add --group-priority" and
remove "dcmanager subcloud-peer-group update --group-priority"
from CLI. This command is not supposed to be used by end user;
Add heartbeat_status into the "dcmanager system-peer show".

Test Plan:
1. PASS - Run 'dcmanager subcloud-peer-group add --group-priority'
          and verify that the error message prompted;
2. PASS - Run the normal 'dcmanager subcloud-peer-group add' (without
          --group-priority) and verify that the command work as
          expected;
3. PASS - Run 'dcmanager subcloud-peer-group update --group-priority'
          and verify that the error message prompted;
4. PASS - Run the normal 'dcmanager subcloud-peer-group update'
          (without --group-priority) and verify that the command work
          as expected;
5. PASS - Run 'dcmanager system-peer show' and verify that the
          command show the heartbeat status;

Story: 2010852
Task: 48970
Task: 48971
Change-Id: Ia50280b7678374793eb4785767de1564cfa84e4e
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2023-10-20 15:09:13 +08:00
Christopher Souza f7487d291f Add the --upload-only option to dcmanager upgrade_strategy CLI
This commit adds a new option --upload-only to dcmanager
upgrade-strategy create. If this option is used, the releases
are uploaded to the subclouds and the strategy state is set to complete.

Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/894170

Test Plan:
1. PASS - Run dcmanager help upgrade-strategy create and verify
that the --upload-only argument is present.
2. PASS - Create and apply a patch strategy using the --upload-only
option and verify that the strategy completes after uploading
the patches to the subclouds.
3. PASS - Create and apply a patch strategy without using the
--upload-only option and verify that the strategy continues
after uploading the patches to the subclouds.
4. PASS - Verify that the CLI output of dcmanager upgrade-strategy
create/delete/show/abort/apply contains the 'upload only' field.

Story: 2010676
Task: 48746

Change-Id: I3ab70ff7287ae54fa4c407ef0f3c15784bfc19a6
Signed-off-by: Christopher Souza <Christopher.DeOliveiraSouza@windriver.com>
2023-09-28 15:53:34 -03:00
twang4 bf3d515c94 Remove subcloud add secondary from CLI
Remove "dcmanager subcloud add --secondary"
from CLI. This command is not supposed to be used by
end user.

Test Plan:
1. PASS - Run 'dcmanager subcloud add --secondary' and verify that the
         error message prompted;
2. PASS - Run a normal 'subcloud add' (without --secondary) and verify
         that the command work as expected.

Story: 2010852
Task: 48818
Signed-off-by: Wang Tao <tao.wang@windriver.com>
Change-Id: Ib3069797a9dcb90242e7eb8ec2584d1b2faf38d4
2023-09-27 11:28:18 +08:00
twang4 04d2517df3 Add Subcloud Peer group management
Group of the current managed subclouds which are supposed
to be duplicated in a peer site as secondary subclouds.

This commit add subcloud-peer-group CMD of
create/delete/update/show/list/
list-subclouds of a subcloud-peer-group

Update subcloud update --peer-group PEER_GROUP
command

CLI example:
dcmanager subcloud update SUBCLOUD
--peer-group PEER_GROUP
dcmanager subcloud-peer-group add \
--peer-group-name NAME
dcmanager subcloud-peer-group delete PEER_GROUP
dcmanager subcloud-peer-group list
dcmanager subcloud-peer-group list-subclouds PEER_GROUP
dcmanager subcloud-peer-group migrate PEER_GROUP\
--sysadmin-password PASSWORD
dcmanager subcloud-peer-group show PEER_GROUP
dcmanager subcloud-peer-group status PEER_GROUP
dcmanager subcloud-peer-group update PEER_GROUP
[--peer-group-name PEER_GROUP_NAME]
[--group-priority GROUP_PRIORITY]
[--group-state GROUP_STATE]
[--max-subcloud-rehoming MAX_SUBCLOUD_REHOMING

Test Plan:
1. PASS - Create a subcloud-peer-group
2. PASS - Add a subcloud, update the peer-group-id as a existing
               subcloud-peer-group successfully;
3. PASS - Verify subcloud-peer-group list-subclouds can get the expected
               Subcloud above successfully;
4. PASS - dcmanager subcloud-peer-group update PEER_GROUP_NAME
               --group-priority/--group-state/--max-subcloud-rehoming
               of a subcloud-peer-group successfully;
5. PASS -  'dcmanager subcloud-peer-group status' and verify the status
                was retrieved successfully.
6. PASS - 'dcmaanger subcloud-peer-group delete' and verify
               the peer group is deleted successfully.
7. PASS - Test 'dcmanager subcloud-peer-group show' command
8. PASS - Test 'dcmanager subcloud-peer-group list' command
9. PASS - Test the help output of all commands and verify that
               the output is correct.
10.PASS - Test the commands 'dcmanager subcloud-peer-group migrate
               PEER_GROUP' without passing the argument and verify that
               it prompts for the password.

Story: 2010852
Task: 48490
Task: 48491
Depends-On: I93d0808b8cf02eba0e6f687007df42e2d2ea1848
Depends-On: I5f7e8862e543d61f49a5456f989c94689db83318
Change-Id: I57ae769c179dd4e613ce4edd432692540deea678
Signed-off-by: Wang Tao <tao.wang@windriver.com>
2023-09-08 09:25:05 +08:00
Cristian Mondo fc1d725206 Subcloud Name Reconfiguration
This change adds the capability to rename the subcloud after
bootstrap or during subcloud rehome operation on CLI.
It also allows to do a subcloud rehoming by changing the
subcloud name from the command line.

Usage for subcloud rename:
dcmanager subcloud update <subcloud-name> --name <new-name>

Usage for subcloud rehoming:
dcmanager subcloud add --name <subcloud-name> --migrate ...

Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/885832

Test Plan:
PASS: Run dcmanager subcloud add with --name parameter
      in order to validate error message because it is not
      allowed to change the name in the subcloud add
      process
PASS: Run dcmanager subcloud add without --name parameter
      in order to validate legacy subcloud add process
PASS: Run dcmanager subcloud update with --name parameter
      supplying different subcloud name
PASS: Run dcmanager subcloud update with --name parameter
      supplying the same name of an existing subcloud
      in order to validate the error message
PASS: Run dcmanager subcloud add with --migrate and --name
      parameters supplying a new subcloud name
PASS: Run dcmanager subcloud add with --migrate and --name
      parameters supplying an existing subcloud name
      in order to validate error message
PASS: Run dcmanager subcloud add with --migrate and
      without --name parameter to get the name from
      bootstrap file and validate subcloud migration process
PASS: Run dcmanager subcloud show and subcloud list to
      validate same current output
PASS: Run dcmanager subcloud show --detail to validate
      new region_name field in detailed list

Story: 2010788
Task: 48216

Signed-off-by: Cristian Mondo <cristian.mondo@windriver.com>
Change-Id: Ib7d7729251b0540a76b8983131c68efe2e47d68a
2023-09-06 17:18:14 -03:00
Salman Rana db6d32fdf7 Fix deploy upload invalid arg exit
Raise a DCManagerClientException to exit from the deploy
upload command handler when an invalid
file arg is encountered. Otherwise, exiting the method
with a simple return results in:
 - an exit code of 0 (a non-zero exit code is expected)
 - Output of an empty deploy table
   (SubcloudDeployUpload is a subclass of DCManagerShowOne.
   A simple return is interpreted as success, hence a console
   output of an empty result is displayed)

Overall, this behavior is misleading as it indicates success
despite the failure. This behavior is specific to the file arg
check (client-side validation done prior to the endpoint call).
Backend errors have been verified to be handled properly,
with a non-zero exit code.

Test Plan:
Using deploy upload (dcmanager subcloud-deploy upload):
  1. PASS: Execute the command with valid
     arguments (correct file references); verify a zero exit code
     (“echo $?”) and console output displaying the
     deploy table.
  2. PASS: Execute the command with an invalid argument
     (missing reference file); verify a non-zero exit code
     (“echo $?”), no deploy table console output and an
     error message “ERROR (app) <arg> does not exist: <file>”

Closes-Bug: 2032970

Change-Id: I53da00a1ba4562aae4345ea1182ca923d227d0e8
Signed-off-by: Salman Rana <salman.rana@windriver.com>
2023-08-30 17:56:58 +00:00
Victor Romano eee5c7cedf Fix distributedcloud-client openstack-tox-docs
This change the default docs language conf to 'en'
instead of None.

Closes-Bug: 2033542

Change-Id: I8a6a5656f9e6993609a43a521547e3d84fd09c77
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
2023-08-30 13:36:25 -03:00
Zuul 29c8ecb0bf Merge "Add system peer management API support" 2023-08-28 13:23:59 +00:00
Gustavo Herzmann ffdecf474c Deprecate dcmanager subcloud reinstall and reconfig
This commit deprecates the dcmanager subcloud reinstall and reconfig
in favor of the new 'dcmanager subcloud redeploy' and 'dcmanager
subcloud deploy config' commands, respectively.

Test Plan:
1. PASS - Run dcmanager subcloud reinstall and verify that it returns
          the deprecation notice instructing the use of 'dcmanager
          subcloud redeploy';
2. PASS - Run dcmanager subcloud reconfig and verify that it returns
          the deprecation notice instructing the use of 'dcmanager
          subcloud deploy config';

Story: 2010756
Task: 48571

Change-Id: I1bf456c48ea6d2784e8369b375197f37ab7c598c
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
2023-08-25 14:49:20 -03:00
Zhang Rong(Jon) 8122ea75d0 Add system peer management API support
Add dcmanager system-peer management api.

Test Plan:
1. PASS - Verify that cloud manage system-peer
          through api successfully.
2. PASS - Run the add command without providing the password
          and verify that the CLI asks for it.
3. PASS - Run the add with every possible parameter and verify
          all of them were successfully passed to the backend.
4. PASS - Verify dcmanager help output the correct help messages
          for each command.

CLI example:
dcmanager system-peer add --peer-uuid 800503ca-21c1-40b2-9425-88319185fe61
--peer-name dc-0 --manager-endpoint http://128.128.128.1:5000/v3
--peer-controller-gateway-address 192.168.205.1
(peer's uuid from the peer site `system show` command)

dcmanager system-peer list

dcmanager system-peer update --administrative-state enabled 1

dcmanager system-peer show 1

dcmanager system-peer delete 1

Story: 2010852
Task: 48487
Depends-On: I349cd24bccc732eb8ed56df9346185cfce7b2570
Change-Id: I7ea22991d8ea879af7401e10b058e7ee44cd6a8d
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
2023-08-25 07:45:51 +00:00
twang4 a8b8077983 Add subcloud secondary status support and migration
Add "subcloud migrate" to rehome a 'secondary' state
subcloud.

Update "dcmanager subcloud add --secondary" command

Update "dcmanager subcloud update --bootstrap-address
--bootstrap-values"
to save data for day-2's rehome/migrate purpose.

Update "dcmanager list subcloud --all" include show
'secondary/secondary-failed' subclouds

Update result of "subcloud show",
add rehome_data section.

Usage:
dcmanager subcloud add --secondary
--bootstrap-address IP
--bootstrap-values [yaml file]

dcmanager subcloud update SUBCLOUD
--bootstrap-address IP
--bootstrap-values [yaml file]

dcmanager subcloud list --all

dcmanager subcloud show SUBCLOUD

dcmanager subcloud migrate SUBCLOUD
--sysadmin-password PASSWORD

Test Plan:
1. PASS - Verify that the dcmanager help subcloud migrate shows
          the correct help message;
2. PASS - Run 'dcmanager subcloud add --secondary' and verify that the
          correct API call is made;
3. PASS - Run 'dcmanager subcloud update --bootstrap-address
          --bootstrap-values' and verify that the
          correct API call is made;

4. PASS - Run 'dcmanager subcloud migrate' and verify that the
          correct API call is made;
5. PASS - Verify that the subcloud name/id parameter is required.

Story: 2010852
Task: 48489
Task: 48504
Depends-On: I9a308a4e2cc5057091ba195c4d05e9d1eb4a950c
Change-Id: Idd10267370dd2cd562c6eacc0d24c47cf68e9fd5
Signed-off-by: Wang Tao <tao.wang@windriver.com>
2023-08-23 12:56:35 +00:00
Zuul b6723b8f67 Merge "Add subcloud redeploy option to dcmanager" 2023-08-22 17:32:50 +00:00
Victor Romano 92e506dd72 Add subcloud redeploy option to dcmanager
This commit adds the command "subcloud redeploy" to
dcmanager client.

Usage:
dcmanager subcloud redeploy
          <subcloud-name-or-id>
          --sysadmin-password <password>
          [--install-values <install-values.yaml>]
          [--bmc-password <password>]
          [--bootstrap-values <bootstrap-values.yaml>]
          [--deploy-config <deployment-config.yaml>]
          [--release <release>]

Test Plan:
  - PASS: Verify the command works with or without --install-values,
          --bmc-password, --bootstrap-values, --deploy-config
          and --release.
  - PASS: Verify that all provided parameters are successfully passed
          to the backend.
  - PASS: Verify that the CLI asks for the sysadmin-password and
          bmc-password if they are not provided in the command
          (bmc-password is only prompt if --install-values
          is also provided).
  - PASS: Verify that the dcmanager help subcloud deploy resume
          shows the correct help message containing all options.

Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/889975

Story: 2010756
Task: 48497

Change-Id: I16857f6779205c4dfcc6d255e0aabdd83496f4c7
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
2023-08-04 09:50:00 -03:00
Gustavo Herzmann d6335fc1cc Add 'subcloud deploy complete' command to dcmanager
This commit adds the subcloud deploy complete command to dcmanager
client. It's used to mark the subcloud deployment as 'complete',
usefull when the user manually configures the subcloud and wants to
finalize the deployment without running 'dcmanager subcloud deploy
config'.

Usage:
dcmanager subcloud deploy complete subcloud-name

To run the 'deploy complete' operation deploy status of the subcloud
must be 'bootstrap-complete'

Test Plan:
1. PASS - Verify that the dcmanager help subcloud deploy complete shows
          the correct help message;
2. PASS - Run 'dcmanager subcloud deploy complete' and verify that the
          correct API call is made;
3. PASS - Verify that the subcloud name/id parameter is required.

Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/889877

Story: 2010756
Task: 48454

Change-Id: I53929dcad068c93982e3381f47f4dda61b3b5d1e
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
2023-07-28 09:29:30 -03:00
Zuul 8da7608d20 Merge "Clean up outdated configs in tox.ini and .zuul.yaml" 2023-07-25 14:58:15 +00:00
Victor Romano 671db8b561 Add subcloud deploy resume option to dcmanager
This commit adds the command "subcloud deploy resume" to
dcmanager client.

Usage:
dcmanager subcloud deploy resume
          <subcloud-name-or-id>
          --sysadmin-password <password>
          [--install-values <install-values.yaml>]
          [--bmc-password <password>]
          [--bootstrap-address <subcloud-bootstrap-address>]
          [--bootstrap-values <bootstrap-values.yaml>]
          [--deploy-config <deployment-config.yaml>]
          [--release <release>]

Test Plan:
  - PASS: Verify the command works with or without --install-values,
          --bmc-password, --bootstrap-address, --bootstrap-values,
          --deploy-config and --release.
  - PASS: Verify that all provided parameters are successfully passed
          to the backend.
  - PASS: Verify that the CLI asks for the sysadmin-password and
          bmc-password if they are not provided in the command
          (bmc-password is only prompt if --install-values
          is also provided).
  - PASS: Verify that the dcmanager help subcloud deploy resume
          shows the correct help message containing all options.

Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/886104

Story: 2010756
Task: 48317

Change-Id: I8a984626007b43e685f326dd4dd05294cd50fcce
Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
2023-07-24 09:32:50 -03:00
Gustavo Pereira fe00700f58 Clean up outdated configs in tox.ini and .zuul.yaml
Tests still have python2.7 configs remaining and some tests
are named -debian, implying the old ones are for centos and
can be removed.

This commit removes the python2.7 and centos configs from tox
and zuul.

Test Plan:

1. PASS - Ran all tests in tox and verified if every test
          finished with the desired output.

2. PASS - Ran tests in zuul environment and checked if
             it was successfull.

Story: 2010531
Task: 48385

Change-Id: I2de9ef82a86e2ce35a3f2a5824f5dac634d2bd1e
Signed-off-by: Gustavo Pereira <gustavo.lyrapereira@windriver.com>
2023-07-20 17:38:24 -03:00
Zuul 86e34c060b Merge "Rename dcmanager subcloud-deploy commands" 2023-07-20 15:52:51 +00:00
Zuul 83712dbec0 Merge "Add subcloud deploy abort option to dcmanager" 2023-07-19 18:13:21 +00:00
Gustavo Herzmann 2b7efc3eea Rename dcmanager subcloud-deploy commands
Renames the 'dcmanager subcloud-deploy upload/show' commands to
'dcmanager subcloud deploy upload/show'. This is done so that the
command names are consistent with the new 'dcmanager subcloud deploy'
commands (add, install, bootstrap, config, abort and resume).

The original commands will return a deprecation notice, instructing
the user to use the new command names.

Test Plan:
1. PASS - Verify that both renamed commands are working as expected (no
          change to the command functionality);
2. PASS - Verify that the old commands are returning the deprecation
          notice instructing the user to use the renamed commands;
3. PASS - Verify that the return code when using the deprecated
          commands is 1;
4. PASS - Verify that the 'dcmanager help' shows the correct help
          message for the renamed commands.

Story: 2010756
Task: 48054

Change-Id: I731b49d74b8d05b411030e3ed83dbc0266df9d9b
Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
2023-07-19 17:40:56 +00:00
Victor Romano c2fa09cfe8 Add subcloud deploy abort option to dcmanager
This commit adds the command "subcloud deploy abort" to
dcmanager client.

Usage:
dcmanager subcloud deploy abort <subcloud-name-or-id>

Test Plan:
  - PASS: Verify the command is succesfully passed to the backend
  - PASS: Verify that the dcmanager help subcloud deploy abort
          shows the correct help message containing all options.

Story: 2010756
Task: 48103

Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/884710

Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
Change-Id: I20e4b7be84e1cacae7f66fc8571dab4715966cdc
2023-07-13 16:29:01 -03:00
Hugo Brito a45e26cfb7 Enhance strategy error messages in dcmanager-api
This commit removes the generic error message from dcmanager-client
to dcmanager-api handle a more detailed message when exceptions occur.
The commands that are affected by this change are:
dcmanager <strategy-type>-strategy create/apply/abort/delete.

Test Plan:

Test Plan:
1. Test the `dcmanager <strategy_type>-strategy create/delete/abort/apply` commands for the following strategies:
- fw-update-strategy, kube-rootca-update-strategy, kube-upgrade-strategy, patch-strategy, prestage-strategy, and upgrade-strategy.
2. Validate that the exception message does not include the old generic reason: "Unable to <command> sw update strategy"

Partial-Bug: 2026604

Change-Id: I60e1188dcbedba7ffb8e8d9e76bb563417b1b69a
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2023-07-11 20:58:42 +00:00
Zuul 822cd5c0c4 Merge "Add subcloud deploy install option to dcmanager" 2023-06-27 16:25:44 +00:00
Zuul 03fd4552b1 Merge "Add the subcloud deploy config option to dcmanager" 2023-06-27 16:25:39 +00:00
Victor Romano a3c4087920 Add subcloud deploy install option to dcmanager
This commit adds the command "subcloud deploy install" to
dcmanager client.

Usage:
dcmanager subcloud deploy install
          <subcloud-name-or-id>
          --sysadmin-password <password>
          [--install-values <install-values.yaml>]
          [--bmc-password <password>]
          [--release <release>]

Test Plan:
  - PASS: Verify the command works with or without --install-values,
          --bmc-password and --release.
  - PASS: Verify that, when provided, the install-values is
          successfully passed to backend.
  - PASS: Verify that the CLI asks for the sysadmin-password and
          bmc-password if they are not provided in the command
          (bmc-password is only prompt if --install-values
          is also provided).
  - PASS: Verify that the dcmanager help subcloud deploy install
          shows the correct help message containing all options.

Depends-on: https://review.opendev.org/c/starlingx/distcloud/+/883976

Story: 2010756
Task: 48057

Signed-off-by: Victor Romano <victor.gluzromano@windriver.com>
Change-Id: I962b0d8e8f1a08d9ea9b572954a4750789108325
2023-06-26 16:36:05 -03:00
Zuul 532898f369 Merge "Add 'subcloud deploy bootstrap' command to dcmanager" 2023-06-21 22:50:34 +00:00