summaryrefslogtreecommitdiff
path: root/cinderclient/v3/shell.py
diff options
context:
space:
mode:
authorJohn Griffith <john.griffith8@gmail.com>2018-04-06 12:51:24 -0600
committerSean McGinnis <sean.mcginnis@gmail.com>2018-07-17 15:58:46 -0500
commit90727008876ef35d3135d494aeb45bdf2f63e8fc (patch)
tree876df9b96f2425aef73b44b9c1e767d12031c3c1 /cinderclient/v3/shell.py
parent8f933a9a341cec9cf87b4a4d3bf7da80b24c18ef (diff)
downloadpython-cinderclient-90727008876ef35d3135d494aeb45bdf2f63e8fc.tar.gz
Add mode option to attachment-create
We introduce a mode option in attachment-create starting with microversion 3.54. The mode option is the new/preferred way of setting ro mode (as opposed to admin-metadata). This patch adds the support for the mode option to the client for endpoints that support 3.54. Depends-on: https://review.openstack.org/532702/ Change-Id: I22cfddd0192c4a72b8f844f23d1fa51b96c57e06
Diffstat (limited to 'cinderclient/v3/shell.py')
-rw-r--r--cinderclient/v3/shell.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index fc74399..d5114e1 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -2164,6 +2164,13 @@ def do_attachment_show(cs, args):
metavar='<mountpoint>',
default=None,
help='Mountpoint volume will be attached at. Default=None.')
+@utils.arg('--mode',
+ metavar='<mode>',
+ default='null',
+ start_version='3.54',
+ help='Mode of attachment, rw, ro and null, where null '
+ 'indicates we want to honor any existing '
+ 'admin-metadata settings. Default=null.')
def do_attachment_create(cs, args):
"""Create an attachment for a cinder volume."""
@@ -2178,9 +2185,12 @@ def do_attachment_create(cs, args):
'multipath': args.multipath,
'mountpoint': args.mountpoint}
volume = utils.find_volume(cs, args.volume)
+ mode = getattr(args, 'mode', 'null')
attachment = cs.attachments.create(volume.id,
connector,
- args.server_id)
+ args.server_id,
+ mode)
+
connector_dict = attachment.pop('connection_info', None)
utils.print_dict(attachment)
if connector_dict: