Add pre-upgrade-deploy flag for upgrades
This commit adds the pre-upgrade-deploy flag to vim for upgrades. It also updates the metapackage display to split them in lines instead of using a comma, improving the field's visibility, and updates the API documentation. Test plan: 1. PASS: Run a sw-deploy-strategy with a major release and specifying the --pre-upgrade-deploy flag. Verify it selects a small list of metapackages and successfully deploys them. 2. PASS: Run a sw-deploy-strategy create command without specifying a release and setting the --pre-upgrade-deploy flag. Verify the CLI returns an error stating the release is required. 3. PASS: Run the same test as 2 while also specifying --rollback and verify the original error of the release being required is raised. 4. PASS: Run a sw-deploy-strategy create for a major release without the --pre-upgrade-deploy flag and verify it selects all metapackages. 5. PASS: Run a sw-deploy-strategy create for a metapackage while also specifying the --pre-upgrade-deploy and verify the build fails stating the metapackage is not a product release. 6. PASS: Run a N-2 to N upgrade and verify it completes successfully. Story: 2011686 Task: 55130 Depends-On: https://review.opendev.org/c/starlingx/update/+/995751 Depends-On: https://review.opendev.org/c/starlingx/update/+/995999 Change-Id: I9627fb4e3a93c49fa93b64728d863a303ba82fad Signed-off-by: Raphael <Raphael.Lima@windriver.com>
This commit is contained in:
1 parent
8f1ee0e5dc
commit
a0326809e0
19 files changed
+249
-58
No files matched your search
@@ -570,7 +570,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -1076,9 +1078,10 @@ Creates a sw-deploy strategy
|
||||
Default value is ``2``."
|
||||
"alarm-restrictions (Optional)", "plain", "xsd:string", "The strictness of alarm checks:
|
||||
``strict`` or ``relaxed`` (recommended option)."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of software releases to deploy. Accepts one or more release identifiers."
|
||||
"rollback", "plain", "xsd:bool", "The flag that indicates this is a rollback action."
|
||||
"delete", "plain", "xsd:bool", "The flag that indicates that deployment will be marked complete."
|
||||
"pre-upgrade-deploy", "plain", "xsd:bool", "The flag that indicates a pre-upgrade-deploy. It can only be used for major releases."
|
||||
|
||||
**Request body example**
|
||||
|
||||
@@ -1090,6 +1093,7 @@ Creates a sw-deploy strategy
|
||||
"release": "stx-10.0.1",
|
||||
"rollback": false,
|
||||
"delete": true,
|
||||
"pre-upgrade-deploy": false,
|
||||
"storage-apply-type": "serial/ignore",
|
||||
"worker-apply-type": "serial/parallel/ignore",
|
||||
"alarm-restrictions": "strict/relaxed"
|
||||
@@ -1122,7 +1126,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -1146,6 +1152,7 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
"current-phase-completion-percentage": 0,
|
||||
"uuid": "ac9b953a-caf1-4abe-8d53-498b598e6731",
|
||||
"release-id": "stx-10.0.1",
|
||||
"metapackages": ["stx-distcloud-1.0.0"],
|
||||
"worker-apply-type": "serial",
|
||||
"storage-apply-type": "serial",
|
||||
"max-parallel-worker-hosts": 2,
|
||||
@@ -1331,7 +1338,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -3919,10 +3928,11 @@ Creates software deploy strategy
|
||||
Default value is ``2``."
|
||||
"alarm-restrictions (Optional)", "plain", "xsd:string", "The strictness of alarm checks:
|
||||
``strict`` or ``relaxed``."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of software releases to deploy. Accepts one or more release identifiers."
|
||||
"rollback", "plain", "xsd:bool", "The flag that indicates this is a rollback action."
|
||||
"delete", "plain", "xsd:bool", "The flag that indicates that deployment will be
|
||||
marked complete."
|
||||
"pre-upgrade-deploy", "plain", "xsd:bool", "The flag that indicates a pre-upgrade-deploy. It can only be used for major releases."
|
||||
|
||||
**Request body example**
|
||||
|
||||
@@ -3934,6 +3944,7 @@ Creates software deploy strategy
|
||||
"release": "stx-10.0.1",
|
||||
"rollback": false,
|
||||
"delete": true,
|
||||
"pre-upgrade-deploy": false,
|
||||
"storage-apply-type": "serial/ignore",
|
||||
"worker-apply-type": "serial/parallel/ignore",
|
||||
"alarm-restrictions": "strict/relaxed"
|
||||
@@ -3966,7 +3977,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -3990,6 +4003,7 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
"current-phase-completion-percentage": 0,
|
||||
"uuid": "ac9b953a-caf1-4abe-8d53-498b598e6731",
|
||||
"release-id": "stx-10.0.1",
|
||||
"metapackages": ["stx-distcloud-1.0.0"],
|
||||
"worker-apply-type": "serial",
|
||||
"storage-apply-type": "serial",
|
||||
"max-parallel-worker-hosts": 2,
|
||||
@@ -4071,7 +4085,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -4175,7 +4191,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of App
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -4308,7 +4326,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of App
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -4408,7 +4428,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -4650,9 +4672,10 @@ Create software deploy strategy.
|
||||
Default value is ``2``."
|
||||
"alarm-restrictions (Optional)", "plain", "xsd:string", "The strictness of alarm checks:
|
||||
``strict`` or ``relaxed``."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of software releases to deploy. Accepts one or more release identifiers."
|
||||
"rollback", "plain", "xsd:bool", "The flag that indicates this is a rollback action."
|
||||
"delete", "plain", "xsd:bool", "The flag that indicates that deployment will be marked complete."
|
||||
"pre-upgrade-deploy", "plain", "xsd:bool", "The flag that indicates a pre-upgrade-deploy. It can only be used for major releases."
|
||||
|
||||
**Request body example**
|
||||
|
||||
@@ -4664,6 +4687,7 @@ Create software deploy strategy.
|
||||
"release": "stx-10.0.1",
|
||||
"rollback": false,
|
||||
"delete": true,
|
||||
"pre-upgrade-deploy": false,
|
||||
"storage-apply-type": "serial/ignore",
|
||||
"worker-apply-type": "serial/parallel/ignore",
|
||||
"alarm-restrictions": "strict/relaxed"
|
||||
@@ -4696,7 +4720,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -4720,6 +4746,7 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
"current-phase-completion-percentage": 0,
|
||||
"uuid": "ac9b953a-caf1-4abe-8d53-498b598e6731",
|
||||
"release-id": "stx-10.0.1",
|
||||
"metapackages": ["stx-distcloud-1.0.0"],
|
||||
"worker-apply-type": "serial",
|
||||
"storage-apply-type": "serial",
|
||||
"max-parallel-worker-hosts": 2,
|
||||
@@ -4801,7 +4828,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -4905,7 +4934,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of App
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -5038,7 +5069,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of App
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -5135,7 +5168,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -5480,9 +5515,10 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
parallel``. Default value is ``2``."
|
||||
"alarm-restrictions (Optional)", "plain", "xsd:string", "The strictness of alarm
|
||||
checks:``strict`` or ``relaxed``."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of software releases to deploy. Accepts one or more release identifiers."
|
||||
"rollback", "plain", "xsd:bool", "The flag that indicates this is a rollback action."
|
||||
"delete", "plain", "xsd:bool", "The flag that indicates that deployment will be marked complete."
|
||||
"pre-upgrade-deploy", "plain", "xsd:bool", "The flag that indicates a pre-upgrade-deploy. It can only be used for major releases."
|
||||
|
||||
|
||||
**Request body example**
|
||||
@@ -5495,6 +5531,7 @@ Use the sw-deploy get strategy request to monitor the progress and status of the
|
||||
"release": null,
|
||||
"rollback": true,
|
||||
"delete": null,
|
||||
"pre-upgrade-deploy": false,
|
||||
"storage-apply-type": "serial/ignore",
|
||||
"worker-apply-type": "serial/parallel/ignore",
|
||||
"alarm-restrictions": "strict/relaxed"
|
||||
@@ -5539,7 +5576,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -5643,7 +5682,9 @@ Use the sw-deploy get strategy request to monitor the progress and status of App
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
@@ -5740,7 +5781,9 @@ The details of the strategy can be checked using below response parameter.
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"name", "plain", "xsd:string", "The current strategy name."
|
||||
"release", "plain", "xsd:string", "The release identification name."
|
||||
"release", "plain", "xsd:list", "The list of releases in the deployment. Only present when release-id and metapackages are not."
|
||||
"release-id", "plain", "xsd:string", "The release identifier of the software deployment. Present once the release information has been retrieved."
|
||||
"metapackages", "plain", "xsd:list", "The list of software metapackages included in the deployment. Present once the release information has been retrieved."
|
||||
"controller-apply-type", "plain", "xsd:string", "Apply type of controller host."
|
||||
"storage-apply-type", "plain", "xsd:string", "Apply type of storage host."
|
||||
"worker-apply-type", "plain", "xsd:string", "Apply type of worker host."
|
||||
|
||||
@@ -330,6 +330,8 @@ def create_strategy(
|
||||
# the parameters are not provided.
|
||||
if kwargs.get("snapshot"):
|
||||
api_cmd_payload["snapshot"] = kwargs.get("snapshot")
|
||||
if kwargs.get("pre_upgrade_deploy"):
|
||||
api_cmd_payload["pre-upgrade-deploy"] = kwargs.get("pre_upgrade_deploy")
|
||||
if kwargs.get("kube_upgrade"):
|
||||
api_cmd_payload["kube-upgrade"] = kwargs.get("kube_upgrade")
|
||||
if kwargs.get("cleanup"):
|
||||
|
||||
@@ -55,6 +55,8 @@ def get_extra_create_args(cmd_area, args):
|
||||
# release is a positional arg.
|
||||
if args.release and args.rollback:
|
||||
raise ValueError("Cannot set both --rollback and release")
|
||||
elif args.pre_upgrade_deploy and not args.release:
|
||||
raise ValueError("Cannot set pre-upgrade deploy without a release")
|
||||
elif args.rollback and args.delete:
|
||||
raise ValueError("Cannot set both --rollback and --delete")
|
||||
elif args.rollback and args.snapshot:
|
||||
@@ -75,6 +77,7 @@ def get_extra_create_args(cmd_area, args):
|
||||
"snapshot": args.snapshot,
|
||||
"kube_upgrade": args.kube_upgrade,
|
||||
"cleanup": args.cleanup,
|
||||
"pre_upgrade_deploy": args.pre_upgrade_deploy,
|
||||
}
|
||||
elif sw_update.CMD_NAME_FW_UPDATE == cmd_area:
|
||||
# no additional kwargs for firmware update
|
||||
@@ -528,6 +531,16 @@ def setup_sw_deploy_parser(commands):
|
||||
required=False,
|
||||
)
|
||||
|
||||
create_strategy_cmd.add_argument(
|
||||
"--pre-upgrade-deploy",
|
||||
help=(
|
||||
"Uses the metapackages from the pre-upgrade-deploy section of the release "
|
||||
"metadata. Only applicable for major releases."
|
||||
),
|
||||
action=argparse.BooleanOptionalAction,
|
||||
required=False,
|
||||
)
|
||||
|
||||
# define the delete command
|
||||
_ = setup_delete_cmd(sub_cmds)
|
||||
# define the apply command
|
||||
|
||||
@@ -41,8 +41,12 @@ STRATEGY_APPLYING = "applying"
|
||||
STRATEGY_READY_TO_APPLY = "ready-to-apply"
|
||||
|
||||
|
||||
def _print(indent_by, field, value, remains=""):
|
||||
def _print(indent_by, field, value, remains="", blank_field=False):
|
||||
full_field = f"{field}:"
|
||||
|
||||
if blank_field:
|
||||
full_field = " "
|
||||
|
||||
if isinstance(value, str) and "\n" in value:
|
||||
full_field = f"{full_field} |\n"
|
||||
|
||||
@@ -199,10 +203,22 @@ def _display_strategy(strategy, details=False, active=False, error_details=False
|
||||
if strategy.name == STRATEGY_NAME_SW_UPGRADE:
|
||||
# When the release information has not been fully retrieved yet,
|
||||
# only display the release parameter the user sent. Otherwise,
|
||||
# display release-id and metapackage data.
|
||||
# display release-id and metapackage data, e.g.
|
||||
# release-id: starlingx-10.0.0
|
||||
# metapackages: k8s-v1.33.0_10.0.0
|
||||
# k8s-v1.32.2_10.0.0
|
||||
# distcloud_10.0.0
|
||||
# controller-apply-type: serial
|
||||
if strategy.release_id and strategy.metapackages:
|
||||
_print(2, "release-id", strategy.release_id)
|
||||
_print(2, "metapackages", ", ".join(strategy.metapackages))
|
||||
# The metapackage list can be too large to display when doing a
|
||||
# major upgrade. Therefore, instead of showing them in a single line,
|
||||
# display one per line.
|
||||
for index, metapackage in enumerate(strategy.metapackages):
|
||||
if index == 0:
|
||||
_print(2, "metapackages", metapackage)
|
||||
continue
|
||||
_print(2, "", metapackage, blank_field=True)
|
||||
else:
|
||||
release = "software deploy selected release(s)"
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ function _swmanager()
|
||||
--snapshot
|
||||
--kube-upgrade
|
||||
--cleanup
|
||||
--pre-upgrade-deploy
|
||||
"
|
||||
local createopt=${prev}
|
||||
case "$createopt" in
|
||||
@@ -105,6 +106,10 @@ function _swmanager()
|
||||
COMPREPLY=($(compgen -W "${createopts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
--pre-upgrade-deploy)
|
||||
COMPREPLY=($(compgen -W "${createopts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -2379,7 +2379,9 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
|
||||
self._upgrade_obj = None
|
||||
|
||||
def sw_deploy_precheck(self, future, release, force, snapshot, callback):
|
||||
def sw_deploy_precheck(
|
||||
self, future, release, force, snapshot, pre_upgrade_deploy, callback
|
||||
):
|
||||
"""Precheck a USM software deploy."""
|
||||
|
||||
response = {}
|
||||
@@ -2402,7 +2404,12 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
self._platform_token = future.result.data
|
||||
|
||||
future.work(
|
||||
usm.sw_deploy_precheck, self._platform_token, release, force, snapshot
|
||||
usm.sw_deploy_precheck,
|
||||
self._platform_token,
|
||||
release,
|
||||
force,
|
||||
snapshot,
|
||||
pre_upgrade_deploy,
|
||||
)
|
||||
future.result = yield
|
||||
if not future.result.is_complete():
|
||||
@@ -2496,7 +2503,9 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
callback.send(response)
|
||||
callback.close()
|
||||
|
||||
def sw_deploy_start(self, future, release, force, snapshot, callback):
|
||||
def sw_deploy_start(
|
||||
self, future, release, force, snapshot, pre_upgrade_deploy, callback
|
||||
):
|
||||
"""Start a USM software deploy."""
|
||||
|
||||
response = {}
|
||||
@@ -2516,7 +2525,12 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
self._platform_token = future.result.data
|
||||
|
||||
future.work(
|
||||
usm.sw_deploy_start, self._platform_token, release, force, snapshot
|
||||
usm.sw_deploy_start,
|
||||
self._platform_token,
|
||||
release,
|
||||
force,
|
||||
snapshot,
|
||||
pre_upgrade_deploy,
|
||||
)
|
||||
future.result = yield
|
||||
|
||||
|
||||
@@ -94,7 +94,9 @@ def sw_deploy_host_list(token):
|
||||
return _api_get(token, _usm_api_cmd(token, "deploy_host"))
|
||||
|
||||
|
||||
def sw_deploy_precheck(token, release, force=False, snapshot=False):
|
||||
def sw_deploy_precheck(
|
||||
token, release, force=False, snapshot=False, pre_upgrade_deploy=False
|
||||
):
|
||||
"""Ask USM to precheck before a deployment."""
|
||||
|
||||
url = _usm_api_cmd(token, "deploy/precheck")
|
||||
@@ -103,11 +105,15 @@ def sw_deploy_precheck(token, release, force=False, snapshot=False):
|
||||
data["force"] = force
|
||||
if snapshot:
|
||||
data["options"] = ["snapshot=true"]
|
||||
if pre_upgrade_deploy:
|
||||
data["pre_upgrade_deploy"] = pre_upgrade_deploy
|
||||
response = _api_post(token, url, data)
|
||||
return response
|
||||
|
||||
|
||||
def sw_deploy_start(token, release, force=False, snapshot=False):
|
||||
def sw_deploy_start(
|
||||
token, release, force=False, snapshot=False, pre_upgrade_deploy=False
|
||||
):
|
||||
"""Ask USM to start a deployment."""
|
||||
|
||||
url = _usm_api_cmd(token, "deploy/start")
|
||||
@@ -116,6 +122,8 @@ def sw_deploy_start(token, release, force=False, snapshot=False):
|
||||
data["force"] = force
|
||||
if snapshot:
|
||||
data["options"] = ["snapshot=true"]
|
||||
if pre_upgrade_deploy:
|
||||
data["pre_upgrade_deploy"] = pre_upgrade_deploy
|
||||
|
||||
response = _api_post(
|
||||
token, url, data, timeout_in_secs=REST_API_DEPLOY_START_TIMEOUT
|
||||
|
||||
@@ -161,6 +161,7 @@ class BaseSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
||||
cleanup=False,
|
||||
snapshot=False,
|
||||
kube_upgrade_version=None,
|
||||
pre_upgrade_deploy=False,
|
||||
nfvi_upgrade=None,
|
||||
single_controller=False,
|
||||
):
|
||||
@@ -185,6 +186,7 @@ class BaseSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
||||
cleanup=cleanup,
|
||||
snapshot=snapshot,
|
||||
kube_upgrade_version=kube_upgrade_version,
|
||||
pre_upgrade_deploy=pre_upgrade_deploy,
|
||||
ignore_alarms=[],
|
||||
single_controller=single_controller,
|
||||
)
|
||||
@@ -4298,6 +4300,7 @@ class TestSwUpgradeCombinedKubeStrategy(BaseSwUpgradeStrategy):
|
||||
single_controller=True,
|
||||
rollback=False,
|
||||
delete=False,
|
||||
release=None,
|
||||
):
|
||||
"""Create a SwUpgradeStrategy with kube_upgrade_version populated.
|
||||
|
||||
@@ -4307,6 +4310,9 @@ class TestSwUpgradeCombinedKubeStrategy(BaseSwUpgradeStrategy):
|
||||
if kube_upgrade_version is None:
|
||||
kube_upgrade_version = self.KUBE_VER
|
||||
|
||||
if release is None:
|
||||
release = self.RELEASE
|
||||
|
||||
strategy = SwUpgradeStrategy(
|
||||
uuid=str(uuid.uuid4()),
|
||||
controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL,
|
||||
@@ -4315,12 +4321,13 @@ class TestSwUpgradeCombinedKubeStrategy(BaseSwUpgradeStrategy):
|
||||
max_parallel_worker_hosts=10,
|
||||
default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START,
|
||||
alarm_restrictions=SW_UPDATE_ALARM_RESTRICTION.STRICT,
|
||||
release=self.RELEASE,
|
||||
release=release,
|
||||
rollback=rollback,
|
||||
delete=delete,
|
||||
cleanup=False,
|
||||
snapshot=False,
|
||||
kube_upgrade_version=kube_upgrade_version,
|
||||
pre_upgrade_deploy=False,
|
||||
ignore_alarms=[],
|
||||
single_controller=single_controller,
|
||||
)
|
||||
@@ -4818,8 +4825,13 @@ class TestSwUpgradeCombinedKubeStrategy(BaseSwUpgradeStrategy):
|
||||
- strategy state is BUILD_FAILED immediately after build()
|
||||
- result_reason contains 'Cannot set both kube_upgrade and rollback'
|
||||
"""
|
||||
# By default the release will be set as [] when sent through the CLI. In such
|
||||
# case, adding the rollback flag would result in a rollback strategy.
|
||||
# To skip the release definition in the _create_combined_strategy, it is used
|
||||
# here as well.
|
||||
strategy = self._create_combined_strategy(
|
||||
rollback=True,
|
||||
release=[],
|
||||
nfvi_upgrade=_make_nfvi_upgrade(self.RELEASE, state="deploying"),
|
||||
)
|
||||
strategy.sw_update_obj = self.fake_upgrade_obj
|
||||
|
||||
@@ -96,6 +96,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
||||
cleanup=False,
|
||||
snapshot=False,
|
||||
kube_upgrade_version=None,
|
||||
pre_upgrade_deploy=False,
|
||||
nfvi_upgrade=None,
|
||||
single_controller=False,
|
||||
):
|
||||
@@ -118,6 +119,7 @@ class TestSwUpgradeStrategy(sw_update_testcase.SwUpdateStrategyTestCase):
|
||||
cleanup=cleanup,
|
||||
snapshot=snapshot,
|
||||
kube_upgrade_version=kube_upgrade_version,
|
||||
pre_upgrade_deploy=pre_upgrade_deploy,
|
||||
ignore_alarms=[],
|
||||
single_controller=single_controller,
|
||||
)
|
||||
|
||||
@@ -138,6 +138,24 @@ class TestSwDeployPrecheck(BaseTestUsm):
|
||||
{"releases": ["r1"], "force": True, "options": ["snapshot=true"]},
|
||||
)
|
||||
|
||||
def test_sw_deploy_precheck_succeeds_with_pre_upgrade_deploy(self):
|
||||
response = usm.sw_deploy_precheck(self.token, ["r1"], pre_upgrade_deploy=True)
|
||||
|
||||
self._assert_request(
|
||||
"deploy/precheck",
|
||||
response,
|
||||
{"releases": ["r1"], "pre_upgrade_deploy": True},
|
||||
)
|
||||
|
||||
def test_sw_deploy_precheck_succeeds_with_omitted_pre_upgrade_deploy(self):
|
||||
response = usm.sw_deploy_precheck(self.token, ["r1"], pre_upgrade_deploy=False)
|
||||
|
||||
self._assert_request(
|
||||
"deploy/precheck",
|
||||
response,
|
||||
{"releases": ["r1"]},
|
||||
)
|
||||
|
||||
|
||||
class TestSwDeployStart(BaseTestUsm):
|
||||
"""Unit tests for the sw_deploy_start payload construction."""
|
||||
@@ -162,6 +180,26 @@ class TestSwDeployStart(BaseTestUsm):
|
||||
usm.REST_API_DEPLOY_START_TIMEOUT,
|
||||
)
|
||||
|
||||
def test_sw_deploy_start_succeeds_with_pre_upgrade_deploy(self):
|
||||
response = usm.sw_deploy_start(self.token, ["r1"], pre_upgrade_deploy=True)
|
||||
|
||||
self._assert_request(
|
||||
"deploy/start",
|
||||
response,
|
||||
{"releases": ["r1"], "pre_upgrade_deploy": True},
|
||||
usm.REST_API_DEPLOY_START_TIMEOUT,
|
||||
)
|
||||
|
||||
def test_sw_deploy_start_succeeds_with_omitted_pre_upgrade_deploy(self):
|
||||
response = usm.sw_deploy_start(self.token, ["r1"], pre_upgrade_deploy=False)
|
||||
|
||||
self._assert_request(
|
||||
"deploy/start",
|
||||
response,
|
||||
{"releases": ["r1"]},
|
||||
usm.REST_API_DEPLOY_START_TIMEOUT,
|
||||
)
|
||||
|
||||
|
||||
class TestSwDeployExecute(BaseTestUsm):
|
||||
"""Unit tests for the sw_deploy_execute request."""
|
||||
|
||||
@@ -173,6 +173,9 @@ class SwUpgradeStrategyCreateData(wsme_types.Base):
|
||||
kube_upgrade = wsme_types.wsattr(
|
||||
str, mandatory=False, name="kube-upgrade", default=None
|
||||
)
|
||||
pre_upgrade_deploy = wsme_types.wsattr(
|
||||
bool, mandatory=False, name="pre-upgrade-deploy", default=None
|
||||
)
|
||||
storage_apply_type = wsme_types.wsattr(
|
||||
SwUpdateApplyTypes, mandatory=True, name="storage-apply-type"
|
||||
)
|
||||
@@ -648,6 +651,7 @@ class SwUpgradeStrategyAPI(SwUpdateStrategyAPI):
|
||||
rpc_request.cleanup = request_data.cleanup
|
||||
rpc_request.snapshot = request_data.snapshot
|
||||
rpc_request.kube_upgrade = request_data.kube_upgrade
|
||||
rpc_request.pre_upgrade_deploy = request_data.pre_upgrade_deploy
|
||||
rpc_request.controller_apply_type = request_data.controller_apply_type
|
||||
rpc_request.storage_apply_type = request_data.storage_apply_type
|
||||
rpc_request.swift_apply_type = SW_UPDATE_APPLY_TYPE.IGNORE
|
||||
|
||||
@@ -51,6 +51,7 @@ class SwMgmtDirector(metaclass=Singleton):
|
||||
cleanup,
|
||||
snapshot,
|
||||
kube_upgrade,
|
||||
pre_upgrade_deploy,
|
||||
callback,
|
||||
):
|
||||
"""Create Software Upgrade Strategy."""
|
||||
@@ -87,6 +88,7 @@ class SwMgmtDirector(metaclass=Singleton):
|
||||
cleanup,
|
||||
snapshot,
|
||||
kube_upgrade,
|
||||
pre_upgrade_deploy,
|
||||
self._ignore_alarms,
|
||||
self._single_controller,
|
||||
)
|
||||
|
||||
@@ -94,6 +94,7 @@ def vim_sw_update_api_create_strategy(connection, msg):
|
||||
cleanup = msg.cleanup
|
||||
snapshot = msg.snapshot
|
||||
kube_upgrade = msg.kube_upgrade
|
||||
pre_upgrade_deploy = msg.pre_upgrade_deploy
|
||||
uuid, reason = sw_mgmt_director.create_sw_upgrade_strategy(
|
||||
controller_apply_type,
|
||||
storage_apply_type,
|
||||
@@ -107,6 +108,7 @@ def vim_sw_update_api_create_strategy(connection, msg):
|
||||
cleanup,
|
||||
snapshot,
|
||||
kube_upgrade,
|
||||
pre_upgrade_deploy,
|
||||
_vim_sw_update_api_create_strategy_callback,
|
||||
)
|
||||
elif "fw-update" == msg.sw_update_type:
|
||||
|
||||
@@ -372,20 +372,30 @@ def nfvi_get_upgrade(release, callback):
|
||||
return cmd_id
|
||||
|
||||
|
||||
def nfvi_sw_deploy_precheck(release, force, snapshot, callback):
|
||||
def nfvi_sw_deploy_precheck(release, force, snapshot, pre_upgrade_deploy, callback):
|
||||
"""Software deploy precheck."""
|
||||
|
||||
cmd_id = _infrastructure_plugin.invoke_plugin(
|
||||
"sw_deploy_precheck", release, force, snapshot, callback=callback
|
||||
"sw_deploy_precheck",
|
||||
release,
|
||||
force,
|
||||
snapshot,
|
||||
pre_upgrade_deploy,
|
||||
callback=callback,
|
||||
)
|
||||
return cmd_id
|
||||
|
||||
|
||||
def nfvi_upgrade_start(release, force, snapshot, callback):
|
||||
def nfvi_upgrade_start(release, force, snapshot, pre_upgrade_deploy, callback):
|
||||
"""Software deploy start."""
|
||||
|
||||
cmd_id = _infrastructure_plugin.invoke_plugin(
|
||||
"sw_deploy_start", release, force, snapshot, callback=callback
|
||||
"sw_deploy_start",
|
||||
release,
|
||||
force,
|
||||
snapshot,
|
||||
pre_upgrade_deploy,
|
||||
callback=callback,
|
||||
)
|
||||
return cmd_id
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ class Upgrade(ObjectData):
|
||||
hosts_info,
|
||||
system_deploy=None,
|
||||
):
|
||||
# TODO(rlima): map the major_release property from the usm requests rather
|
||||
# than using the current validation logic.
|
||||
super().__init__("1.0.0")
|
||||
self.release = release
|
||||
self.metapackages = metapackages
|
||||
|
||||
@@ -48,6 +48,7 @@ class SwUpgrade(SwUpdate, KubeUpgradeMixin):
|
||||
cleanup,
|
||||
snapshot,
|
||||
kube_upgrade,
|
||||
pre_upgrade_deploy,
|
||||
ignore_alarms,
|
||||
single_controller,
|
||||
):
|
||||
@@ -85,6 +86,7 @@ class SwUpgrade(SwUpdate, KubeUpgradeMixin):
|
||||
cleanup,
|
||||
snapshot,
|
||||
kube_upgrade,
|
||||
pre_upgrade_deploy,
|
||||
ignore_alarms,
|
||||
single_controller,
|
||||
)
|
||||
|
||||
@@ -65,6 +65,7 @@ class APIRequestCreateSwUpgradeStrategy(APIRequestCreateSwUpdateStrategy):
|
||||
cleanup = None
|
||||
snapshot = None
|
||||
kube_upgrade = None
|
||||
pre_upgrade_deploy = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -82,6 +83,7 @@ class APIRequestCreateSwUpgradeStrategy(APIRequestCreateSwUpdateStrategy):
|
||||
msg["cleanup"] = self.cleanup
|
||||
msg["snapshot"] = self.snapshot
|
||||
msg["kube_upgrade"] = self.kube_upgrade
|
||||
msg["pre_upgrade_deploy"] = self.pre_upgrade_deploy
|
||||
|
||||
def deserialize_payload(self, msg):
|
||||
super().deserialize_payload(msg)
|
||||
@@ -91,6 +93,7 @@ class APIRequestCreateSwUpgradeStrategy(APIRequestCreateSwUpdateStrategy):
|
||||
self.cleanup = msg.get("cleanup", None)
|
||||
self.snapshot = msg.get("snapshot", None)
|
||||
self.kube_upgrade = msg.get("kube_upgrade", None)
|
||||
self.pre_upgrade_deploy = msg.get("pre_upgrade_deploy", None)
|
||||
|
||||
def __str__(self):
|
||||
return "create-sw-deploy-strategy request: %s" % self.deserialize_payload
|
||||
|
||||
@@ -1434,6 +1434,7 @@ class SwUpgradeStrategy(
|
||||
cleanup,
|
||||
snapshot,
|
||||
kube_upgrade_version,
|
||||
pre_upgrade_deploy,
|
||||
ignore_alarms,
|
||||
single_controller,
|
||||
):
|
||||
@@ -1455,6 +1456,7 @@ class SwUpgradeStrategy(
|
||||
self._delete = delete
|
||||
self._cleanup = cleanup
|
||||
self._snapshot = snapshot
|
||||
self._pre_upgrade_deploy = pre_upgrade_deploy
|
||||
if kube_upgrade_version and not kube_upgrade_version.startswith("v"):
|
||||
kube_upgrade_version = "v" + kube_upgrade_version
|
||||
self._kube_upgrade_version = kube_upgrade_version
|
||||
@@ -1549,7 +1551,9 @@ class SwUpgradeStrategy(
|
||||
# Precheck is part of create phase because DC requested it
|
||||
stage.add_step(
|
||||
strategy.SwDeployPrecheckStep(
|
||||
release=self._release, snapshot=self._snapshot
|
||||
release=self._release,
|
||||
snapshot=self._snapshot,
|
||||
pre_upgrade_deploy=self._pre_upgrade_deploy,
|
||||
)
|
||||
)
|
||||
self.build_phase.add_stage(stage)
|
||||
@@ -1577,26 +1581,25 @@ class SwUpgradeStrategy(
|
||||
def build(self):
|
||||
"""Build the strategy."""
|
||||
|
||||
if self._kube_upgrade_version and self._rollback:
|
||||
reason = "Cannot set both kube_upgrade and rollback"
|
||||
self.report_build_failure(reason)
|
||||
elif self._release and self._rollback:
|
||||
reason = "Cannot set both release and rollback"
|
||||
self.report_build_failure(reason)
|
||||
|
||||
elif self._rollback and self._delete is not None:
|
||||
reason = "Cannot set both delete and rollback, delete is set by default"
|
||||
self.report_build_failure(reason)
|
||||
|
||||
# The build validations should be the same as the ones in the client
|
||||
# (nfv/nfv-client/nfv_client/shell.py)
|
||||
if self._release and self._rollback:
|
||||
self.report_build_failure("Cannot set both release and rollback")
|
||||
elif self._pre_upgrade_deploy and not self._release:
|
||||
self.report_build_failure("Cannot set pre-upgrade deploy without a release")
|
||||
elif self._rollback and self._delete:
|
||||
self.report_build_failure(
|
||||
"Cannot set both delete and rollback, delete is set by default"
|
||||
)
|
||||
# TODO(sshathee): Remove this conditon when implementing snapshot
|
||||
# with rollback command
|
||||
elif self._rollback and self._snapshot is not None:
|
||||
reason = (
|
||||
elif self._rollback and self._snapshot:
|
||||
self.report_build_failure(
|
||||
"Cannot set both snapshot and rollback, if snapshot"
|
||||
"is available it will be forcibly used."
|
||||
)
|
||||
self.report_build_failure(reason)
|
||||
|
||||
elif self._rollback and self._kube_upgrade_version:
|
||||
self.report_build_failure("Cannot set both kube_upgrade and rollback")
|
||||
elif self._cleanup and any(
|
||||
[
|
||||
self._release,
|
||||
@@ -1606,11 +1609,10 @@ class SwUpgradeStrategy(
|
||||
self._kube_upgrade_version,
|
||||
]
|
||||
):
|
||||
reason = (
|
||||
self.report_build_failure(
|
||||
"Cannot set release, rollback, snapshot, delete or kube-upgrade "
|
||||
"when cleanup is set"
|
||||
)
|
||||
self.report_build_failure(reason)
|
||||
|
||||
elif self._rollback:
|
||||
return self._build_rollback()
|
||||
@@ -1649,7 +1651,11 @@ class SwUpgradeStrategy(
|
||||
# sw-deploy start for major releases must be done on controller-0
|
||||
self._swact_fix(stage, HOST_NAME.CONTROLLER_1)
|
||||
stage.add_step(
|
||||
strategy.UpgradeStartStep(release=self._release, snapshot=self._snapshot)
|
||||
strategy.UpgradeStartStep(
|
||||
release=self._release,
|
||||
snapshot=self._snapshot,
|
||||
pre_upgrade_deploy=self._pre_upgrade_deploy,
|
||||
)
|
||||
)
|
||||
stage.add_step(
|
||||
strategy.QueryAlarmsStep(False, ignore_alarms=self._ignore_alarms)
|
||||
|
||||
@@ -774,10 +774,11 @@ class SystemConfigUpdateHostsStep(strategy.StrategyStep):
|
||||
class SwDeployPrecheckStep(strategy.StrategyStep):
|
||||
"""Software Deploy Precheck - Strategy Step."""
|
||||
|
||||
def __init__(self, release, snapshot=False):
|
||||
def __init__(self, release, snapshot=False, pre_upgrade_deploy=False):
|
||||
super().__init__(STRATEGY_STEP_NAME.SW_DEPLOY_PRECHECK, timeout_in_secs=60)
|
||||
self._release = release
|
||||
self._snapshot = snapshot
|
||||
self._pre_upgrade_deploy = pre_upgrade_deploy
|
||||
|
||||
@coroutine
|
||||
def _sw_deploy_precheck_callback(self):
|
||||
@@ -821,6 +822,7 @@ class SwDeployPrecheckStep(strategy.StrategyStep):
|
||||
self._release,
|
||||
force,
|
||||
self._snapshot,
|
||||
self._pre_upgrade_deploy,
|
||||
self._sw_deploy_precheck_callback(),
|
||||
)
|
||||
return strategy.STRATEGY_STEP_RESULT.WAIT, ""
|
||||
@@ -833,6 +835,7 @@ class SwDeployPrecheckStep(strategy.StrategyStep):
|
||||
super().from_dict(data)
|
||||
self._release = normalize_release(data["release"])
|
||||
self._snapshot = data.get("snapshot", False)
|
||||
self._pre_upgrade_deploy = data.get("pre_upgrade_deploy", False)
|
||||
return self
|
||||
|
||||
def as_dict(self):
|
||||
@@ -841,6 +844,7 @@ class SwDeployPrecheckStep(strategy.StrategyStep):
|
||||
data = super().as_dict()
|
||||
data["release"] = self._release
|
||||
data["snapshot"] = self._snapshot
|
||||
data["pre_upgrade_deploy"] = self._pre_upgrade_deploy
|
||||
data["entity_type"] = ""
|
||||
data["entity_names"] = []
|
||||
data["entity_uuids"] = []
|
||||
@@ -1172,11 +1176,12 @@ class UpgradeHostsStep(strategy.StrategyStep):
|
||||
class UpgradeStartStep(strategy.StrategyStep):
|
||||
"""Upgrade Start - Strategy Step."""
|
||||
|
||||
def __init__(self, release, snapshot=False, timeout=None):
|
||||
def __init__(self, release, snapshot=False, pre_upgrade_deploy=False, timeout=None):
|
||||
super().__init__(STRATEGY_STEP_NAME.START_UPGRADE, timeout_in_secs=self.TIMEOUT)
|
||||
|
||||
self._release = release
|
||||
self._snapshot = snapshot
|
||||
self._pre_upgrade_deploy = pre_upgrade_deploy
|
||||
self._query_inprogress = False
|
||||
|
||||
@property
|
||||
@@ -1269,7 +1274,11 @@ class UpgradeStartStep(strategy.StrategyStep):
|
||||
]
|
||||
|
||||
nfvi.nfvi_upgrade_start(
|
||||
self._release, force, self._snapshot, self._start_upgrade_callback()
|
||||
self._release,
|
||||
force,
|
||||
self._snapshot,
|
||||
self._pre_upgrade_deploy,
|
||||
self._start_upgrade_callback(),
|
||||
)
|
||||
|
||||
return result, reason
|
||||
@@ -1299,6 +1308,7 @@ class UpgradeStartStep(strategy.StrategyStep):
|
||||
super().from_dict(data)
|
||||
self._release = normalize_release(data["release"])
|
||||
self._snapshot = data.get("snapshot", False)
|
||||
self._pre_upgrade_deploy = data.get("pre_upgrade_deploy", False)
|
||||
self._query_inprogress = False
|
||||
return self
|
||||
|
||||
@@ -1311,6 +1321,7 @@ class UpgradeStartStep(strategy.StrategyStep):
|
||||
data["entity_uuids"] = []
|
||||
data["release"] = self._release
|
||||
data["snapshot"] = self._snapshot
|
||||
data["pre_upgrade_deploy"] = self._pre_upgrade_deploy
|
||||
return data
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user