From 5a18f995a8ef31efb9ab324e2b5c9e572e75c2d1 Mon Sep 17 00:00:00 2001 From: Rajat Dhasmana Date: Thu, 7 Dec 2023 19:31:46 +0530 Subject: [PATCH] volume: Deprecate '--retype-policy' in favor of '--migration-policy' The '--retype-policy' option is used in the 'volume set' command to specify the migration policy during the retype operation. The '--retype-policy' option does not convey the correct meaning of its usage. The migration policy determines whether we are going to perform the migration in the retype operation or not and is not related to the actual retype which just changes the volume type of the volume. Change-Id: I2ea8fd3f5277bb3422ccae915d05e8ad44ff1912 --- openstackclient/volume/v2/volume.py | 32 +++++++++++++++---- ...me-set-retype-policy-6bacb7dd92f1ad82.yaml | 8 +++++ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/rename-volume-set-retype-policy-6bacb7dd92f1ad82.yaml diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index 4127e23d4..2073e0a53 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -711,6 +711,12 @@ class SetVolume(command.Command): '--retype-policy', metavar='', choices=['never', 'on-demand'], + help=argparse.SUPPRESS, + ) + parser.add_argument( + '--migration-policy', + metavar='', + choices=['never', 'on-demand'], help=_( 'Migration policy while re-typing volume ' '("never" or "on-demand", default is "never" ) ' @@ -746,6 +752,15 @@ class SetVolume(command.Command): volume = utils.find_resource(volume_client.volumes, parsed_args.volume) result = 0 + if parsed_args.retype_policy: + msg = _( + "The '--retype-policy' option has been deprecated in favor " + "of '--migration-policy' option. The '--retype-policy' option " + "will be removed in a future release. Please use " + "'--migration-policy' instead." + ) + self.log.warning(msg) + if parsed_args.size: try: if parsed_args.size <= volume.size: @@ -839,11 +854,12 @@ class SetVolume(command.Command): e, ) result += 1 + policy = parsed_args.migration_policy or parsed_args.retype_policy if parsed_args.type: # get the migration policy migration_policy = 'never' - if parsed_args.retype_policy: - migration_policy = parsed_args.retype_policy + if policy: + migration_policy = policy try: # find the volume type volume_type = utils.find_resource( @@ -856,12 +872,14 @@ class SetVolume(command.Command): except Exception as e: LOG.error(_("Failed to set volume type: %s"), e) result += 1 - elif parsed_args.retype_policy: - # If the "--retype-policy" is specified without "--type" + elif policy: + # If the "--migration-policy" is specified without "--type" LOG.warning( - _( - "'--retype-policy' option will not work " - "without '--type' option" + _("'%s' option will not work without '--type' option") + % ( + '--migration-policy' + if parsed_args.migration_policy + else '--retype-policy' ) ) diff --git a/releasenotes/notes/rename-volume-set-retype-policy-6bacb7dd92f1ad82.yaml b/releasenotes/notes/rename-volume-set-retype-policy-6bacb7dd92f1ad82.yaml new file mode 100644 index 000000000..93380c1c2 --- /dev/null +++ b/releasenotes/notes/rename-volume-set-retype-policy-6bacb7dd92f1ad82.yaml @@ -0,0 +1,8 @@ +--- +upgrade: + - | + The ``volume set --retype-policy`` parameter has been renamed to + ``--migration-policy`` to better convey the correct meaning of the options + usage. The migration policy determines whether we are going to perform the + migration in the retype opearation or not and is not related to the actual + retype which just changes the volume type of the volume.