diff --git a/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py b/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py index 3dc4a837..f67308de 100644 --- a/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py +++ b/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py @@ -991,10 +991,33 @@ class PrestageSubcloud(base.DCManagerShowOne): "--release", required=False, help="software release used to prestage the subcloud with. " + "Format: YY.MM or YY.MM.nn. " "If not specified, the current software release of " "the subcloud will be used.", ) + parser.add_argument( + "--for-install", + required=False, + action="store_true", + help=( + "Prestage for installation. This is the default prestaging option." + ), + ) + # Prestaging for deployment means prestaging for upgrade + # With USM there is no install phase for upgrades. This operation + # therefore targets the live ostree repo on the subcloud (not + # /opt/platform-backup) + parser.add_argument( + "--for-sw-deploy", + required=False, + action="store_true", + help=( + "Prestage for software deploy operations. If not specified, " + "prestaging is targeted towards full installation." + ), + ) + return parser def _get_resources(self, parsed_args): @@ -1017,6 +1040,16 @@ class PrestageSubcloud(base.DCManagerShowOne): if parsed_args.release: data["release"] = parsed_args.release + if parsed_args.for_sw_deploy: + if parsed_args.for_install: + error_msg = ( + "Options --for-install and --for-sw-deploy cannot be combined" + ) + raise exceptions.DCManagerClientException(error_msg) + data["for_sw_deploy"] = "true" + else: + # for_install is the default + data["for_install"] = "true" try: result = subcloud_manager.prestage_subcloud( @@ -1025,6 +1058,9 @@ class PrestageSubcloud(base.DCManagerShowOne): update_fields_values(result) return result + except exceptions.DCManagerClientException: + raise + except Exception as exc: print(exc) error_msg = f"Unable to prestage subcloud {subcloud_ref}" diff --git a/distributedcloud-client/dcmanagerclient/commands/v1/sw_prestage_manager.py b/distributedcloud-client/dcmanagerclient/commands/v1/sw_prestage_manager.py index bb1049d9..e14ca0de 100644 --- a/distributedcloud-client/dcmanagerclient/commands/v1/sw_prestage_manager.py +++ b/distributedcloud-client/dcmanagerclient/commands/v1/sw_prestage_manager.py @@ -15,6 +15,7 @@ import base64 +from dcmanagerclient import exceptions from dcmanagerclient import utils from dcmanagerclient.commands.v1 import sw_update_manager @@ -73,10 +74,31 @@ class CreateSwPrestageStrategy( required=False, help=( "software release used to prestage the subcloud with. " + "Format: YY.MM or YY.MM.nn. " "If not specified, the current software release of " "the subcloud will be used." ), ) + parser.add_argument( + "--for-install", + required=False, + action="store_true", + help=( + "Prestage for installation. This is the default prestaging option." + ), + ) + # Prestaging for deployment means prestaging for upgrade + # For this operation, there is NO INSTALL phase anymore with USM + # - targets the live ostree repo on the subcloud (not /opt/platform-backup) + parser.add_argument( + "--for-sw-deploy", + required=False, + action="store_true", + help=( + "Prestage for software deploy operations. If not specified, " + "prestaging is targeted towards full installation." + ), + ) return parser @@ -100,6 +122,17 @@ class CreateSwPrestageStrategy( if parsed_args.release is not None: kwargs_dict["release"] = parsed_args.release + if parsed_args.for_sw_deploy: + if parsed_args.for_install: + error_msg = ( + "Options --for-install and --for-sw-deploy cannot be combined" + ) + raise exceptions.DCManagerClientException(error_msg) + kwargs_dict["for_sw_deploy"] = "true" + else: + # for_install is the default + kwargs_dict["for_install"] = "true" + # override validate_force_params defined in CreateSwUpdateStrategy def validate_force_params(self, parsed_args): pass