From 3ebc7520a6ecdf6260757daf7ad913a1bff4e342 Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Sun, 25 Sep 2016 15:44:03 +0800 Subject: [PATCH] Add warning message for --state option of set command in volume There are some set commands can set object state, it maybe a danger behavor for users, so add explanation and warning in the help message of the "--state" option to talk users be caution when using (cinderclient have done this too) Change-Id: I6a902887ea98879999c9972f36b1b7ef332173c3 --- doc/source/command-objects/snapshot.rst | 5 +++-- doc/source/command-objects/volume-backup.rst | 2 ++ doc/source/command-objects/volume.rst | 4 +++- openstackclient/volume/v2/backup.py | 5 ++++- openstackclient/volume/v2/snapshot.py | 7 +++++-- openstackclient/volume/v2/volume.py | 5 ++++- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/doc/source/command-objects/snapshot.rst b/doc/source/command-objects/snapshot.rst index ce2d9c8eab..a2709adbe5 100644 --- a/doc/source/command-objects/snapshot.rst +++ b/doc/source/command-objects/snapshot.rst @@ -123,8 +123,9 @@ Set snapshot properties .. option:: --state New snapshot state. - Valid values are "available", "error", "creating", - "deleting", and "error_deleting". + ("available", "error", "creating", "deleting", or "error_deleting") (admin only) + (This option simply changes the state of the snapshot in the database with + no regard to actual status, exercise caution when using) *Volume version 2 only* diff --git a/doc/source/command-objects/volume-backup.rst b/doc/source/command-objects/volume-backup.rst index 05b02345ce..246fd38eb2 100644 --- a/doc/source/command-objects/volume-backup.rst +++ b/doc/source/command-objects/volume-backup.rst @@ -140,6 +140,8 @@ Set volume backup properties .. option:: --state New backup state ("available" or "error") (admin only) + (This option simply changes the state of the backup in the database with + no regard to actual status, exercise caution when using) .. _backup_set-volume-backup: .. describe:: diff --git a/doc/source/command-objects/volume.rst b/doc/source/command-objects/volume.rst index 26d4ead6f0..f772557fc6 100644 --- a/doc/source/command-objects/volume.rst +++ b/doc/source/command-objects/volume.rst @@ -235,7 +235,9 @@ Set volume properties New volume state ("available", "error", "creating", "deleting", "in-use", - "attaching", "detaching", "error_deleting" or "maintenance") + "attaching", "detaching", "error_deleting" or "maintenance") (admin only) + (This option simply changes the state of the volume in the database with + no regard to actual status, exercise caution when using) *Volume version 2 only* diff --git a/openstackclient/volume/v2/backup.py b/openstackclient/volume/v2/backup.py index 4a133d3644..2ca35b24b2 100644 --- a/openstackclient/volume/v2/backup.py +++ b/openstackclient/volume/v2/backup.py @@ -305,7 +305,10 @@ class SetVolumeBackup(command.Command): '--state', metavar='', choices=['available', 'error'], - help=_('New backup state ("available" or "error") (admin only)'), + help=_('New backup state ("available" or "error") (admin only) ' + '(This option simply changes the state of the backup ' + 'in the database with no regard to actual status, ' + 'exercise caution when using)'), ) return parser diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py index 0d82655108..4994e0da3c 100644 --- a/openstackclient/volume/v2/snapshot.py +++ b/openstackclient/volume/v2/snapshot.py @@ -230,8 +230,11 @@ class SetSnapshot(command.Command): metavar='', choices=['available', 'error', 'creating', 'deleting', 'error-deleting'], - help=_('New snapshot state. Valid values are available, ' - 'error, creating, deleting, and error-deleting.'), + help=_('New snapshot state. ("available", "error", "creating", ' + '"deleting", or "error_deleting") (admin only) ' + '(This option simply changes the state of the snapshot ' + 'in the database with no regard to actual status, ' + 'exercise caution when using)'), ) return parser diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index 0805b2be67..b006718996 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -402,7 +402,10 @@ class SetVolume(command.Command): 'maintenance'], help=_('New volume state ("available", "error", "creating", ' '"deleting", "in-use", "attaching", "detaching", ' - '"error_deleting" or "maintenance")'), + '"error_deleting" or "maintenance") (admin only) ' + '(This option simply changes the state of the volume ' + 'in the database with no regard to actual status, ' + 'exercise caution when using)'), ) bootable_group = parser.add_mutually_exclusive_group() bootable_group.add_argument(