Support volume attach set ro/rw mode
Currently, when attach a volume to an instance, cinder api interface has supported to specify attach mode. This mode can be valued by ro or rw. The cinder api like this:
@wsgi.
def _attach(self, req, id, body):
"""Add attachment metadata."""
......
# instance uuid is an option now
if 'instance_uuid' in body['os-attach']:
......
mountpoint = body['os-
if 'mode' in body['os-attach']:
mode = body['os-
else:
mode = 'rw'
......
if mode not in ('rw', 'ro'):
msg = _("Invalid request to attach volume with an invalid mode. "
raise webob.exc.
try:
except messaging.
Out of consideration of data security, users sometimes need a set of VM disk attached as read-only. So the mode is useful for user. But currently nova has no way to set the mode. So, The BP's intention is to allow Nova to volume-attach to support passed the mode parameter.
Currently, The CLI command like this:
[root@stack ~(keystone_admin)]# nova help volume-attach
usage: nova volume-attach <server> <volume> [<device>]
Attach a volume to a server.
Positional arguments:
<server> Name or ID of server.
<volume> ID of the volume to attach.
<device> Name of the device e.g. /dev/vdb. Use "auto" for autoassign (if
Maybe we can add a positional arguments <mode>, the value is in ro or rw. If the user has no specify the mode parameter, rw is set in default.
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- YaoZheng_ZTE
- Direction:
- Needs approval
- Assignee:
- YaoZheng_ZTE
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by