Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

vcd_vapp_vm power on operation fails #187

Open
jbcreek opened this issue Aug 3, 2021 · 2 comments
Open

vcd_vapp_vm power on operation fails #187

jbcreek opened this issue Aug 3, 2021 · 2 comments
Labels
bug Something isn't working in-progress

Comments

@jbcreek
Copy link

jbcreek commented Aug 3, 2021

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 "", line 102, in \n File "", line 94, in _ansiballz_main\n File "", line 40, in invoke_module\n File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/modules/vcd_vapp_vm.py", line 664, in \n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/modules/vcd_vapp_vm.py", line 658, in main\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/module_utils/basic.py", line 2220, in fail_json\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/module_utils/basic.py", line 2193, in _return_formatted\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/module_utils/basic.py", line 420, in remove_values\n File "/tmp/ansible_vcd_vapp_vm_payload_lnngr98u/ansible_vcd_vapp_vm_payload.zip/ansible/module_utils/basic.py", line 397, in _remove_values_conditions\nTypeError: Value of unknown type: <class 'pyvcloud.vcd.exceptions.OperationNotSupportedException'>, Can't deploy vm. Current state of vm: Powered off.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

@jbcreek
Copy link
Author

jbcreek commented Aug 3, 2021

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.
VM-poweredon-and-off

If I set the power_on setting to true, then the poweroff and poweron operations work fine.

mukultaneja added a commit that referenced this issue Feb 10, 2022
This commit tries to address an issue while power
on/off a vm.

Work towards: #187
@mukultaneja
Copy link
Collaborator

mukultaneja commented Feb 10, 2022

@jbcreek, I apologize for the very late response here. I tried to address this issue in the commit 1f26057. Could you please try this fix once?

@mukultaneja mukultaneja added bug Something isn't working in-progress labels Feb 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working in-progress
Projects
None yet
Development

No branches or pull requests

2 participants