Attach an attached/detached volume from OpenStack VM’s should return similar information (#21558)

Currently, attach an attached volume from OpenStack VM’s returns only
argument data. It is better to return full data as attaching a detached
volume.

In my use case, I need the extra data to mount and format the volume.
pull/63722/head
phongle1205 5 years ago committed by Abhijeet Kasurde
parent 78158c2e63
commit 331d51fb16

@ -0,0 +1,2 @@
minor_changes:
- Attach an attached/detached volume from OpenStack VM's should return similar information in os_server_volume module.

@ -110,19 +110,18 @@ def main():
module.exit_json(changed=_system_state_change(state, dev))
if state == 'present':
if dev:
# Volume is already attached to this server
module.exit_json(changed=False)
cloud.attach_volume(server, volume, module.params['device'],
wait=wait, timeout=timeout)
changed = False
if not dev:
changed = True
cloud.attach_volume(server, volume, module.params['device'],
wait=wait, timeout=timeout)
server = cloud.get_server(module.params['server']) # refresh
volume = cloud.get_volume(module.params['volume']) # refresh
hostvars = cloud.get_openstack_vars(server)
module.exit_json(
changed=True,
changed=changed,
id=volume['id'],
attachments=volume['attachments'],
openstack=hostvars

Loading…
Cancel
Save