ansible-module-vcloud-director
ansible-module-vcloud-director copied to clipboard
vcd_vapp_vm power on operation fails
When using the poweron operation of vcd_vapp_vm I receive an error.
-
name: Power on VM vcd_vapp_vm: org: "{{ org_name }}" target_vapp: "{{ vapp_name }}" target_vdc: "{{ vdc_name }}" target_vm_name: "{{ inventory_hostname }}" operation: "poweron" delegate_to: localhost
-
ansible 2.10.11
-
VMware Cloud Director version: 10.2.1.17444397 Mon Jan 11 04:48:56 UTC 2021
-
API version 35.0
Trace:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Value of unknown type: <class 'pyvcloud.vcd.exceptions.OperationNotSupportedException'>, Can't deploy vm. Current state of vm: Powered off.
fatal: [JCREEK-TEST2]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/client.py", line 1451, in post_linked_resource\n find_link(resource, rel, media_type).href, contents,\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/client.py", line 1755, in find_link\n raise MissingLinkException(resource.get('href'), rel, media_type)\npyvcloud.vcd.exceptions.MissingLinkException: ('https://vcloud02.sde.nycng911.com/api/vApp/vm-540916f6-7083-48d4-a6b0-6ad63a709d72', <RelationType.DEPLOY: 'deploy'>, 'application/vnd.vmware.vcloud.deployVAppParams+xml'); href: https://vcloud02.sde.nycng911.com/api/vApp/vm-540916f6-7083-48d4-a6b0-6ad63a709d72, rel: RelationType.DEPLOY, mediaType: application/vnd.vmware.vcloud.deployVAppParams+xml\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/vm.py", line 390, in _perform_power_operation\n media_type, contents)\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/client.py", line 1455, in post_linked_resource\n "Operation is not supported").with_traceback(e.traceback)\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/client.py", line 1451, in post_linked_resource\n find_link(resource, rel, media_type).href, contents,\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/client.py", line 1755, in find_link\n raise MissingLinkException(resource.get('href'), rel, media_type)\npyvcloud.vcd.exceptions.OperationNotSupportedException: Operation is not supported\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/modules/vcd_vapp_vm.py", line 652, in main\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/modules/vcd_vapp_vm.py", line 283, in manage_operations\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/modules/vcd_vapp_vm.py", line 493, in power_on_vm\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/modules/vcd_vapp_vm.py", line 536, in deploy_vm\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/vm.py", line 541, in deploy\n contents=deploy_vm_params)\n File "/home/jcreek/.local/lib/python3.6/site-packages/pyvcloud/vcd/vm.py", line 395, in _perform_power_operation\n operation_name, VCLOUD_STATUS_MAP[power_state]))\npyvcloud.vcd.exceptions.OperationNotSupportedException: Can't deploy vm. Current state of vm: Powered off.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "
This happens after creating the vm with vcd_vapp_vm and setting power_on to false. The VM ends up in a powered on and powered off state.
If I set the power_on setting to true, then the poweroff and poweron operations work fine.
@jbcreek, I apologize for the very late response here. I tried to address this issue in the commit https://github.com/vmware/ansible-module-vcloud-director/commit/1f26057d79fe1396405e771e7c5d282c565a9fba. Could you please try this fix once?