diff --git a/sysinv/cgts-client/cgts-client/cgtsclient/v1/load.py b/sysinv/cgts-client/cgts-client/cgtsclient/v1/load.py index 77d89f6549..4eb80a33eb 100644 --- a/sysinv/cgts-client/cgts-client/cgtsclient/v1/load.py +++ b/sysinv/cgts-client/cgts-client/cgtsclient/v1/load.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015-2020 Wind River Systems, Inc. +# Copyright (c) 2015-2022 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -11,7 +11,7 @@ from cgtsclient import exc CREATION_ATTRIBUTES = ['software_version', 'compatible_version', 'required_patches'] -IMPORT_ATTRIBUTES = ['path_to_iso', 'path_to_sig', 'active'] +IMPORT_ATTRIBUTES = ['path_to_iso', 'path_to_sig', 'active', 'local'] class Load(base.Resource): @@ -55,11 +55,17 @@ class LoadManager(base.Manager): if key in IMPORT_ATTRIBUTES: if key == 'active': active = value + elif key == 'local': + local = value else: load_info[key] = value else: raise exc.InvalidAttribute(key) + if local is True: + load_info['active'] = active + return self._create(path, body=load_info) + json_data = self._upload_multipart( path, body=load_info, data={'active': active}, check_exceptions=True) return self.resource_class(self, json_data) diff --git a/sysinv/cgts-client/cgts-client/cgtsclient/v1/load_shell.py b/sysinv/cgts-client/cgts-client/cgtsclient/v1/load_shell.py index c029566613..ec9c44ddd1 100644 --- a/sysinv/cgts-client/cgts-client/cgtsclient/v1/load_shell.py +++ b/sysinv/cgts-client/cgts-client/cgtsclient/v1/load_shell.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2016 Wind River Systems, Inc. +# Copyright (c) 2015-2022 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -73,8 +73,18 @@ def do_load_delete(cc, args): help=("Perform an active load import operation. " "Applicable only for SystemController to allow import of " "an active load for subcloud install")) +@utils.arg('--local', + action='store_true', + default=False, + help=("Import the load locally from the active controller. " + "To use this option, first upload the .iso and .sig files to " + "the active controller and then specify the absolute path of " + "both files as 'isopath' and 'sigpath'")) def do_load_import(cc, args): """Import a load.""" + + local = args.local + # If absolute path is not specified, we assume it is the relative path. # args.isopath will then be set to the absolute path if not os.path.isabs(args.isopath): @@ -105,7 +115,7 @@ def do_load_import(cc, args): "old or unused load before importing a new one.")) patch = {'path_to_iso': args.isopath, 'path_to_sig': args.sigpath, - 'active': active} + 'active': active, 'local': local} try: print("This operation will take a while. Please wait.")