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.
This commit is contained in:
parent
78158c2e63
commit
331d51fb16
2 changed files with 8 additions and 7 deletions
2
changelogs/fragments/os_server_volume.yml
Normal file
2
changelogs/fragments/os_server_volume.yml
Normal file
|
@ -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…
Reference in a new issue