community.vmware icon indicating copy to clipboard operation
community.vmware copied to clipboard

vmotion to destination_storage_cluster not working (?)

Open rimkov opened this issue 4 months ago • 2 comments

SUMMARY

i'm trying to perform a vmotion storage to a datastore cluster but i got an exception "list index out of range"

my cluster datastore is named "DatastoreCluster"

here is govc output

Name:            DatastoreCluster
  Path:          /Datacenter/datastore/prod1/DatastoreCluster
  Capacity:      131071.0 GB
  Free:          129563.8 GB
  SDRS Enabled:  true
  SDRS Mode:     automated
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_vmotion module

ANSIBLE VERSION

ansible-core 2.15 with AWX

COLLECTION VERSION

community.vmware 5.0.1

OS / ENVIRONMENT

AWX 23.5.1 Execution environnement

STEPS TO REPRODUCE

here is my playbook i'm retrieving all vm within a specified folder and i loop on each entry for vmotion

    - name: "Get vm list from given folder"
      community.vmware.vmware_vm_info:
        validate_certs: no
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        folder: "{{ folder }}"
      delegate_to: localhost
      register: vm_info

    - name: "Perform storage vMotion : {{ vm['guest_name'] }} to DatastoreCluster"
      community.vmware.vmware_vmotion:
        validate_certs: no
        hostname: '{{ vcenter_hostname }}'
        username: '{{ vcenter_username }}'
        password: '{{ vcenter_password }}'
        destination_cluster_datastore: 'DatastoreCluster'
        vm_name: '{{ item["guest_name"] }}'
      delegate_to: localhost
      loop: '{{ vm_info.virtual_machines }}'
EXPECTED RESULTS

playbook is running without any error and vmotion are performed

ACTUAL RESULTS

traceback : "list index out of range"

{
  "module_stdout": "",
  "module_stderr": "Traceback (most recent call last):\n  File \"/runner/.ansible/tmp/ansible-tmp-1729168477.8109813-41-236219999763408/AnsiballZ_vmware_vmotion.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/runner/.ansible/tmp/ansible-tmp-1729168477.8109813-41-236219999763408/AnsiballZ_vmware_vmotion.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/runner/.ansible/tmp/ansible-tmp-1729168477.8109813-41-236219999763408/AnsiballZ_vmware_vmotion.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_vmotion', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_vmotion', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 555, in <module>\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 551, in main\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 388, in __init__\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 482, in set_placement\nIndexError: list index out of range\n",
  "exception": "Traceback (most recent call last):\n  File \"/runner/.ansible/tmp/ansible-tmp-1729168477.8109813-41-236219999763408/AnsiballZ_vmware_vmotion.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/runner/.ansible/tmp/ansible-tmp-1729168477.8109813-41-236219999763408/AnsiballZ_vmware_vmotion.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/runner/.ansible/tmp/ansible-tmp-1729168477.8109813-41-236219999763408/AnsiballZ_vmware_vmotion.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_vmotion', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_vmotion', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 555, in <module>\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 551, in main\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 388, in __init__\n  File \"/tmp/ansible_community.vmware.vmware_vmotion_payload_v_trk9l9/ansible_community.vmware.vmware_vmotion_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_vmotion.py\", line 482, in set_placement\nIndexError: list index out of range\n",
  "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
}

i tried with a simple list of vm as playbook variable and the result is the same

i tried with datastore_destination and a specific storage pod and it's working :

    - name: "Perform storage vMotion : {{ vm['guest_name'] }} to datastore"
      community.vmware.vmware_vmotion:
        validate_certs: no
        hostname: '{{ vcenter_hostname }}'
        username: '{{ vcenter_username }}'
        password: '{{ vcenter_password }}'
        destination_datastore: 'prodstor1-ds01'
        vm_name: '{{ item["guest_name"] }}'
      delegate_to: localhost
      loop: '{{ vm_info.virtual_machines }}'

thank you for your help, I hope I was clear.

rimkov avatar Oct 17 '24 14:10 rimkov