distcloud/distributedcloud/dcmanager/tests/unit/manager
Yuxing Jiang c659a7f684 Create an API to reinstall a subcloud
This commit creates a REST API to reinstall a subcloud.

In SubcloudController, the tasks includes:
1. Read the subcloud info from dcmanager db, subclouds table.
2. JSONify the data_install from db, generate the new install values.

In SubcloudManager:
1. Check the subcloud availability, software version before reinstall
2. Check the image value, if image doesn't exists, update the image with
iso in dc-vault
3. Run the install command and apply command

API format: PATCH /v1.0/subclouds/<subcloud>/reinstall
-----
Tests:
-----
Happy path:
1. dcmanager subcloud add: a new subcloud with bootstrap values,
deploy config and install values.
2. dcmanager subcloud delete: an existing subcloud.
3. dcmanager subcloud reconfig: an existing subcloud with deploy
config.
4. dcmanager subcloud reinstall: an existing offline subcloud, this
subcloud has image path in data_install in db dcmanager. After the
tasks of reinstall and bootstrap succeed, reconfig this subcloud with
proper deploy config, this subcloud will be online.
5. upload an image to dc-vault using: system --os-region-name
SystemController load-import -a <bootimage.iso> <bootimage.sig>. Then
using dcmanager subcloud reinstall to an existing offline subcloud,
this subcloud has no image path in data_install in db dcmanager. After
the tasks of reinstall and bootstrap succeed, reconfig this subcloud
with proper deploy config, this subcloud will be online.

Unhappy path:
1. dcmanager subcloud reinstall: an existing online subcloud,
reinstall fails.
2. dcmanager subcloud reinstall: an existing subcloud without
data_install value in db, reinstall fails.
3. dcmanager subcloud reinstall: an existing subcloud with
data_install in db, but missing mandatory install value, reinstall
fails.
4. dcmanager subcloud reinstall: an existing subcloud, but its sw
version in db doesn't meet the sw version with system controllers',
reinstall fails.
5. dcmanager subcloud reinstall: an existing subcloud with
data_install in db, but has no image path in data_install, and also
has no right versioned image in dc-vault in system controller,
reinstall fails.

Story: 2007267
Task: 40732
Change-Id: I8be6d8d11e6b4ee02bbcca499ba8869ba76bffaa
Signed-off-by: Yuxing Jiang <yuxing.jiang@windriver.com>
2020-10-09 10:11:35 -04:00
..
states/upgrade Move dcmanager orchestration to a separate process 2020-09-14 11:17:06 -04:00
__init__.py Move content to subdir to support relocated packaging 2019-11-04 13:57:02 -05:00
test_service.py Move dcmanager orchestration to a separate process 2020-09-14 11:17:06 -04:00
test_subcloud_manager.py Create an API to reinstall a subcloud 2020-10-09 10:11:35 -04:00