summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v2
diff options
context:
space:
mode:
authorqtang <qtang@vmware.com>2016-08-25 10:56:58 +0800
committerDean Troyer <dtroyer@gmail.com>2016-09-14 16:35:49 +0000
commit6a914d0056e810e1ef37eaf4f01cd5c85217aba6 (patch)
tree0dd31314930bc68b4d99012f9caabd9ddce5984c /openstackclient/volume/v2
parentd2273ecea5d540f4dacc89772870722355f2492f (diff)
downloadpython-openstackclient-6a914d0056e810e1ef37eaf4f01cd5c85217aba6.tar.gz
Support mark volume as bootable in volume set
Add --bootable | --non-bootable option in volume set to mark or unmark volume as bootable. Change-Id: Ifa6c2dd1642202f55b6d50e3b8614d3513d488f6 Closes-Bug:#1535704
Diffstat (limited to 'openstackclient/volume/v2')
-rw-r--r--openstackclient/volume/v2/volume.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index 28946a5f..804e2337 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -404,6 +404,17 @@ class SetVolume(command.Command):
'"deleting", "in-use", "attaching", "detaching", '
'"error_deleting" or "maintenance")'),
)
+ bootable_group = parser.add_mutually_exclusive_group()
+ bootable_group.add_argument(
+ "--bootable",
+ action="store_true",
+ help=_("Mark volume as bootable")
+ )
+ bootable_group.add_argument(
+ "--non-bootable",
+ action="store_true",
+ help=_("Mark volume as non-bootable")
+ )
return parser
def take_action(self, parsed_args):
@@ -446,6 +457,13 @@ class SetVolume(command.Command):
except Exception as e:
LOG.error(_("Failed to set volume state: %s"), e)
result += 1
+ if parsed_args.bootable or parsed_args.non_bootable:
+ try:
+ volume_client.volumes.set_bootable(
+ volume.id, parsed_args.bootable)
+ except Exception as e:
+ LOG.error(_("Failed to set volume bootable property: %s"), e)
+ result += 1
kwargs = {}
if parsed_args.name: