summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v2
diff options
context:
space:
mode:
authorXi Yang <yang.xi@99cloud.net>2016-01-18 15:47:23 +0800
committerHuanxuan Ao <huanxuan.ao@easystack.cn>2016-08-03 12:19:16 +0800
commit20ae54045cef136a8d0665aab0d45698e12ed21c (patch)
treed50a920f55d5dd93c3b78db41345f1908e36c556 /openstackclient/volume/v2
parenteaee74bba253bf04471055bbe51db6aad2975a7a (diff)
downloadpython-openstackclient-20ae54045cef136a8d0665aab0d45698e12ed21c.tar.gz
Add support of setting volume's state
OSC does not support to set volume's state, this patch is going to add this functionality. Closes-Bug:#1535213 Change-Id: I5bc1c7e81b8ba61c37f4bfd209fc86c5857fb050 Co-Authored-By: Huanxuan Ao <huanxuan.ao@easystack.cn>
Diffstat (limited to 'openstackclient/volume/v2')
-rw-r--r--openstackclient/volume/v2/volume.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index 6f055922..aee18e4f 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -378,6 +378,16 @@ class SetVolume(command.Command):
help=_('Set an image property on this volume '
'(repeat option to set multiple image properties)'),
)
+ parser.add_argument(
+ "--state",
+ metavar="<state>",
+ choices=['available', 'error', 'creating', 'deleting',
+ 'in-use', 'attaching', 'detaching', 'error_deleting',
+ 'maintenance'],
+ help=_('New volume state ("available", "error", "creating", '
+ '"deleting", "in-use", "attaching", "detaching", '
+ '"error_deleting" or "maintenance")'),
+ )
return parser
def take_action(self, parsed_args):
@@ -400,6 +410,8 @@ class SetVolume(command.Command):
if parsed_args.image_property:
volume_client.volumes.set_image_metadata(
volume.id, parsed_args.image_property)
+ if parsed_args.state:
+ volume_client.volumes.reset_state(volume.id, parsed_args.state)
kwargs = {}
if parsed_args.name: