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 6 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)) module.exit_json(changed=_system_state_change(state, dev))
if state == 'present': if state == 'present':
if dev: changed = False
# Volume is already attached to this server if not dev:
module.exit_json(changed=False) changed = True
cloud.attach_volume(server, volume, module.params['device'],
cloud.attach_volume(server, volume, module.params['device'], wait=wait, timeout=timeout)
wait=wait, timeout=timeout)
server = cloud.get_server(module.params['server']) # refresh server = cloud.get_server(module.params['server']) # refresh
volume = cloud.get_volume(module.params['volume']) # refresh volume = cloud.get_volume(module.params['volume']) # refresh
hostvars = cloud.get_openstack_vars(server) hostvars = cloud.get_openstack_vars(server)
module.exit_json( module.exit_json(
changed=True, changed=changed,
id=volume['id'], id=volume['id'],
attachments=volume['attachments'], attachments=volume['attachments'],
openstack=hostvars openstack=hostvars

Loading…
Cancel
Save