HewlettPackard / oneview-ansible-collection

Ansible Collection and Sample Playbooks for HPE OneView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oneview_server_profile cannot create more than one server profile in parallel

jullienl opened this issue · comments

Re-opening #152 because the problem appears again in the latest version.

TASK [Creating Server Profile "ESX-1 from Server Profile Template ESXi_BFS_Frame4"] ******************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: hpeOneView.exceptions.HPEOneViewTaskError: A profile is already assigned to the server hardware {"name":"Frame4, bay 2", "uri":"/rest/server-hardware/39313738-3034-5A43-3231-32343036474D"}.
fatal: [ESX-1 -> localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1650447337.6171565-3193028-109933316272242/AnsiballZ_oneview_server_profile.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1650447337.6171565-3193028-109933316272242/AnsiballZ_oneview_server_profile.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1650447337.6171565-3193028-109933316272242/AnsiballZ_oneview_server_profile.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.hpe.oneview.plugins.modules.oneview_server_profile', init_globals=None, run_name='__main__', alter_sys=True)\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_oneview_server_profile_payload_kcruweip/ansible_oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py\", line 702, in <module>\n  File \"/tmp/ansible_oneview_server_profile_payload_kcruweip/ansible_oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py\", line 698, in main\n  File \"/tmp/ansible_oneview_server_profile_payload_kcruweip/ansible_oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/module_utils/oneview.py\", line 671, in run\n  File \"/tmp/ansible_oneview_server_profile_payload_kcruweip/ansible_oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py\", line 287, in execute_module\n  File \"/tmp/ansible_oneview_server_profile_payload_kcruweip/ansible_oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py\", line 327, in __present\n  File \"/tmp/ansible_oneview_server_profile_payload_kcruweip/ansible_oneview_server_profile_payload.zip/ansible_collections/hpe/oneview/plugins/modules/oneview_server_profile.py\", line 467, in __create_profile\n  File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/servers/server_profiles.py\", line 74, in create\n    resource_data = self._helper.create(data, timeout=timeout, force=force)\n  File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 464, in create\n    return self.do_post(uri, data, timeout, custom_headers)\n  File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/resource.py\", line 816, in do_post\n    return self._task_monitor.wait_for_task(task, timeout)\n  File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/task_monitor.py\", line 82, in wait_for_task\n    task_response = self.__get_task_response(task)\n  File \"/usr/local/lib/python3.6/site-packages/hpeOneView/resources/task_monitor.py\", line 142, in __get_task_response\n    raise HPEOneViewTaskError(msg, error_code)\nhpeOneView.exceptions.HPEOneViewTaskError: A profile is already assigned to the server hardware {\"name\":\"Frame4, bay 2\", \"uri\":\"/rest/server-hardware/39313738-3034-5A43-3231-32343036474D\"}.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
^C [ERROR]: User interrupted execution

Hi Jullienl,

We have fixed the issue and the changes are now available in branch 'server_profile_concurrency_issue'. Can you please check the same and let us know if you are facing any issue.

Thanks,
Alisha

Hi, yes the issue is fixed. Thanks a lot !