Skip to content

Commit 9467b40

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "volume: Deprecate '--retype-policy' in favor of '--migration-policy'"
2 parents 1a38af5 + 5a18f99 commit 9467b40

2 files changed

Lines changed: 33 additions & 7 deletions

File tree

openstackclient/volume/v2/volume.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,12 @@ def get_parser(self, prog_name):
720720
'--retype-policy',
721721
metavar='<retype-policy>',
722722
choices=['never', 'on-demand'],
723+
help=argparse.SUPPRESS,
724+
)
725+
parser.add_argument(
726+
'--migration-policy',
727+
metavar='<migration-policy>',
728+
choices=['never', 'on-demand'],
723729
help=_(
724730
'Migration policy while re-typing volume '
725731
'("never" or "on-demand", default is "never" ) '
@@ -755,6 +761,15 @@ def take_action(self, parsed_args):
755761
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
756762

757763
result = 0
764+
if parsed_args.retype_policy:
765+
msg = _(
766+
"The '--retype-policy' option has been deprecated in favor "
767+
"of '--migration-policy' option. The '--retype-policy' option "
768+
"will be removed in a future release. Please use "
769+
"'--migration-policy' instead."
770+
)
771+
self.log.warning(msg)
772+
758773
if parsed_args.size:
759774
try:
760775
if parsed_args.size <= volume.size:
@@ -848,11 +863,12 @@ def take_action(self, parsed_args):
848863
e,
849864
)
850865
result += 1
866+
policy = parsed_args.migration_policy or parsed_args.retype_policy
851867
if parsed_args.type:
852868
# get the migration policy
853869
migration_policy = 'never'
854-
if parsed_args.retype_policy:
855-
migration_policy = parsed_args.retype_policy
870+
if policy:
871+
migration_policy = policy
856872
try:
857873
# find the volume type
858874
volume_type = utils.find_resource(
@@ -865,12 +881,14 @@ def take_action(self, parsed_args):
865881
except Exception as e:
866882
LOG.error(_("Failed to set volume type: %s"), e)
867883
result += 1
868-
elif parsed_args.retype_policy:
869-
# If the "--retype-policy" is specified without "--type"
884+
elif policy:
885+
# If the "--migration-policy" is specified without "--type"
870886
LOG.warning(
871-
_(
872-
"'--retype-policy' option will not work "
873-
"without '--type' option"
887+
_("'%s' option will not work without '--type' option")
888+
% (
889+
'--migration-policy'
890+
if parsed_args.migration_policy
891+
else '--retype-policy'
874892
)
875893
)
876894

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
upgrade:
3+
- |
4+
The ``volume set --retype-policy`` parameter has been renamed to
5+
``--migration-policy`` to better convey the correct meaning of the options
6+
usage. The migration policy determines whether we are going to perform the
7+
migration in the retype opearation or not and is not related to the actual
8+
retype which just changes the volume type of the volume.

0 commit comments

Comments
 (0)