{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/38941","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/38941/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/38941/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/38941/events","html_url":"https://github.com/ansible/ansible/issues/38941","id":315419688,"number":38941,"title":"vmware_guest: valid request fails with \"Access to resource settings is restricted\"","user":{"login":"piotrplazienski","id":35734174,"avatar_url":"https://avatars0.githubusercontent.com/u/35734174?v=4","gravatar_id":"","url":"https://api.github.com/users/piotrplazienski","html_url":"https://github.com/piotrplazienski","followers_url":"https://api.github.com/users/piotrplazienski/followers","following_url":"https://api.github.com/users/piotrplazienski/following{/other_user}","gists_url":"https://api.github.com/users/piotrplazienski/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrplazienski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrplazienski/subscriptions","organizations_url":"https://api.github.com/users/piotrplazienski/orgs","repos_url":"https://api.github.com/users/piotrplazienski/repos","events_url":"https://api.github.com/users/piotrplazienski/events{/privacy}","received_events_url":"https://api.github.com/users/piotrplazienski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-18T10:20:44Z","updated_at":"2018-04-18T10:24:34Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nVerify first that your issue/request is not already reported on GitHub.\r\nAlso test if the latest release, and devel branch are affected too.\r\nAlways add information AFTER of these html comments. -->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nvmware_guest\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste, BELOW THIS COMMENT, verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\n  config file = None\r\n  configured module search path = [u'/home/app021/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible\r\n  executable location = /usr/local/bin/ansible\r\n  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- If using Ansible 2.4 or above, paste, BELOW THIS COMMENT, the results of \"ansible-config dump --only-changed\"\r\nOtherwise, mention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).-->\r\nDefault.\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Mention, BELOW THIS COMMENT, the OS you are running Ansible from, and the OS you are\r\nmanaging, or say \"N/A\" for anything that is not platform-specific.\r\nAlso mention the specific version of what you are trying to control,\r\ne.g. if this is a network bug the version of firmware on the network device.-->\r\nUbuntu Server 17.10\r\nESXi 6.0.0/vCenter Server 6.0.0\r\n\r\n##### SUMMARY\r\nWhen ESXi/vCenter is configured in particular way, valid change in vm configuration fails. \r\nSame change works with Ansible 2.4.x.\r\n##### STEPS TO REPRODUCE\r\n<!--- For bugs, show exactly how to reproduce the problem, using a minimal test-case.\r\nFor new features, show how the feature would be used. -->\r\nESXi must allow direct access, and resource allocation must be controlled by vCenter (so it is not possible to change it on ESXi, must be changed on vCenter)\r\nRun vmware_guest module to change vm properties other than resource allocation (cpu/mem in this case). Use ESXi address/credentials to connect, **NOT** vCenter ones. Example playbook listed below.\r\nIt also fails same way when module is called directly with ansible args:\r\npython /usr/local/lib/python2.7/dist-packages/ansible/modules/cloud/vmware/vmware_guest.py ansible_args.json\r\n(Example Ansible args also pasted below)\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n- hosts: localhost\r\n  gather_facts: false\r\n  tasks:\r\n    - vmware_guest:\r\n        username: root\r\n        password: apassword\r\n        hostname: <esxi address>\r\n        name: \"a-vm-name\"\r\n        hardware:\r\n          memory_mb: 4096\r\n          num_cpus: 6\r\n        state: present\r\n```\r\n\r\n```\r\n{\r\n    \"ANSIBLE_MODULE_ARGS\": {\r\n        \"datacenter\": \"ha-datacenter\",\r\n        \"hardware\": {\r\n            \"memory_mb\": \"4096\",\r\n            \"num_cpus\": \"4\"\r\n        },\r\n        \"hostname\": \"<esxi address>\",\r\n        \"name\": \"a-vm-name\",\r\n        \"password\": \"apassword\",\r\n        \"state\": \"present\",\r\n        \"username\": \"root\"\r\n    }\r\n}\r\n```\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\nConfiguration is changed properly. It works this way with Ansible 2.4\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\nFails with:\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\n \"Access to resource settings on the host is restricted to the server that is managing it: '<vcenter address>'.\"\r\n```\r\nThis is caused by adding empty `vim.ResourceAllocationInfo()` and `vim.ResourceAllocationInfo()` to `vim.vm.ConfigSpec()` used for requesting change in cpu/mem, even though there is no resource configuration specified in vmware_guest call. \r\nIt is empty request but it seems to trigger permission check anyway, failing whole request.\r\nI have altered the code by removing empty requests and it works."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/382340361","html_url":"https://github.com/ansible/ansible/issues/38941#issuecomment-382340361","issue_url":"https://api.github.com/repos/ansible/ansible/issues/38941","id":382340361,"user":{"login":"ansibot","id":6585283,"avatar_url":"https://avatars0.githubusercontent.com/u/6585283?v=4","gravatar_id":"","url":"https://api.github.com/users/ansibot","html_url":"https://github.com/ansibot","followers_url":"https://api.github.com/users/ansibot/followers","following_url":"https://api.github.com/users/ansibot/following{/other_user}","gists_url":"https://api.github.com/users/ansibot/gists{/gist_id}","starred_url":"https://api.github.com/users/ansibot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansibot/subscriptions","organizations_url":"https://api.github.com/users/ansibot/orgs","repos_url":"https://api.github.com/users/ansibot/repos","events_url":"https://api.github.com/users/ansibot/events{/privacy}","received_events_url":"https://api.github.com/users/ansibot/received_events","type":"User","site_admin":false},"created_at":"2018-04-18T10:24:34Z","updated_at":"2018-04-18T10:24:34Z","author_association":"CONTRIBUTOR","body":"Files identified in the description:\n* [lib/ansible/modules/cloud/vmware/vmware_guest.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/vmware/vmware_guest.py)\n\nIf these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.\n\n[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)\n<!--- boilerplate: components_banner --->"}}
{"actor":{"display_login":"ansibot"}}