HewlettPackard / oneview-ansible

This project is no longer being developed and has limited support. Please use the newer Ansible Collection project: https://github.com/HewlettPackard/oneview-ansible-collection
Apache License 2.0
104 stars 65 forks source link

oneview_server_profile cannot create multiple server profile in parallel #313

Closed tdovan closed 5 years ago

tdovan commented 6 years ago

Scenario/Intent

create multiple server in parallel. (just two in fact)

Environment Details

Steps to Reproduce

just run the following yml:

only add 2 hosts in your inventory

Expected Result

2 server profile created in Synergy

Actual Result

[root@docker-engine-1 dcos-hpe-oneview]# ansible-playbook tan.yml -vvv ansible-playbook 2.4.3.0 config file = /home/tdovan/iac/demo4/dcos-hpe-oneview/ansible.cfg configured module search path = [u'/home/tdovan/iac/demo2/oneview-ansible/library'] ansible python module location = /usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible executable location = /usr/local/bin/ansible-playbook python version = 2.7.9 (default, Jan 28 2018, 20:49:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] Using /home/tdovan/iac/demo4/dcos-hpe-oneview/ansible.cfg as config file Parsed /home/tdovan/iac/demo4/dcos-hpe-oneview/hosts inventory source with ini plugin

PLAYBOOK: tan.yml *** 1 plays in tan.yml

PLAY [Deploy node webservers on RHEL 7.2 servers] *** META: ran handlers

TASK [Create server profile with deployment plan Infra-as-Code-RHEL-7.3-BASE-OS] **** task path: /home/tdovan/iac/demo4/dcos-hpe-oneview/tan.yml:25 Sunday 28 January 2018 21:36:12 +0100 (0:00:00.072) 0:00:00.072 **** Using module file /home/tdovan/iac/demo2/oneview-ansible/library/oneview_server_profile.py

ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' Using module file /home/tdovan/iac/demo2/oneview-ansible/library/oneview_server_profile.py ESTABLISH LOCAL CONNECTION FOR USER: root EXEC /bin/sh -c 'echo ~ && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748 `" && echo ansible-tmp-1517171772.68-62334070299748="` echo /root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748 `" ) && sleep 0' EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242 `" && echo ansible-tmp-1517171772.68-47295080967242="` echo /root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242 `" ) && sleep 0' PUT /tmp/tmpUX34PB TO /root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748/oneview_server_profile.py PUT /tmp/tmpOSsmL0 TO /root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242/oneview_server_profile.py EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748/ /root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748/oneview_server_profile.py && sleep 0' EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242/ /root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242/oneview_server_profile.py && sleep 0' EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748/oneview_server_profile.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1517171772.68-62334070299748/" > /dev/null 2>&1 && sleep 0' EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242/oneview_server_profile.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1517171772.68-47295080967242/" > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py", line 611, in main() File "/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py", line 607, in main ServerProfileModule().run() File "/tmp/ansible_UFhYLY/ansible_modlib.zip/ansible/module_utils/oneview.py", line 428, in run result = self.execute_module() File "/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py", line 255, in execute_module created, changed, msg, server_profile = self.__present(data, server_profile) File "/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py", line 297, in __present resource = self.__create_profile(data, server_template) File "/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py", line 423, in __create_profile return self.oneview_client.server_profiles.create(server_profile) File "build/bdist.linux-x86_64/egg/hpOneView/resources/servers/server_profiles.py", line 66, in create return self._client.create(resource=resource, timeout=timeout, default_values=self.DEFAULT_VALUES) File "build/bdist.linux-x86_64/egg/hpOneView/resources/resource.py", line 451, in create return self.__do_post(uri, resource, timeout, custom_headers) File "build/bdist.linux-x86_64/egg/hpOneView/resources/resource.py", line 765, in __do_post return self._task_monitor.wait_for_task(task, timeout) File "build/bdist.linux-x86_64/egg/hpOneView/resources/task_monitor.py", line 88, in wait_for_task task_response = self.__get_task_response(task) File "build/bdist.linux-x86_64/egg/hpOneView/resources/task_monitor.py", line 147, in __get_task_response raise HPOneViewTaskError(msg, error_code) HPOneViewTaskError: A profile is already assigned to the server hardware {/rest/server-hardware/33323337-3035-5A43-3337-303443395241}. fatal: [agent1 -> localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py\", line 611, in \n main()\n File \"/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py\", line 607, in main\n ServerProfileModule().run()\n File \"/tmp/ansible_UFhYLY/ansible_modlib.zip/ansible/module_utils/oneview.py\", line 428, in run\n result = self.execute_module()\n File \"/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py\", line 255, in execute_module\n created, changed, msg, server_profile = self.__present(data, server_profile)\n File \"/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py\", line 297, in __present\n resource = self.__create_profile(data, server_template)\n File \"/tmp/ansible_UFhYLY/ansible_module_oneview_server_profile.py\", line 423, in __create_profile\n return self.oneview_client.server_profiles.create(server_profile)\n File \"build/bdist.linux-x86_64/egg/hpOneView/resources/servers/server_profiles.py\", line 66, in create\n return self._client.create(resource=resource, timeout=timeout, default_values=self.DEFAULT_VALUES)\n File \"build/bdist.linux-x86_64/egg/hpOneView/resources/resource.py\", line 451, in create\n return self.__do_post(uri, resource, timeout, custom_headers)\n File \"build/bdist.linux-x86_64/egg/hpOneView/resources/resource.py\", line 765, in __do_post\n return self._task_monitor.wait_for_task(task, timeout)\n File \"build/bdist.linux-x86_64/egg/hpOneView/resources/task_monitor.py\", line 88, in wait_for_task\n task_response = self.__get_task_response(task)\n File \"build/bdist.linux-x86_64/egg/hpOneView/resources/task_monitor.py\", line 147, in __get_task_response\n raise HPOneViewTaskError(msg, error_code)\nHPOneViewTaskError: A profile is already assigned to the server hardware {/rest/server-hardware/33323337-3035-5A43-3337-303443395241}.\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0 } ^CProcess WorkerProcess-2: Traceback (most recent call last): File "/usr/local/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/executor/process/worker.py", line 118, in run self._rslt_q File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/executor/task_executor.py", line 130, in run res = self._execute() File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/executor/task_executor.py", line 528, in _execute result = self._handler.run(task_vars=variables) File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/plugins/action/normal.py", line 45, in run results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars, wrap_async=wrap_async)) File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/plugins/action/__init__.py", line 739, in _execute_module res = self._low_level_execute_command(cmd, sudoable=sudoable, in_data=in_data) File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/plugins/action/__init__.py", line 888, in _low_level_execute_command rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable) File "/usr/local/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible/plugins/connection/local.py", line 133, in exec_command stdout, stderr = p.communicate(in_data) File "/usr/local/lib/python2.7/subprocess.py", line 799, in communicate return self._communicate(input) File "/usr/local/lib/python2.7/subprocess.py", line 1409, in _communicate stdout, stderr = self._communicate_with_poll(input) File "/usr/local/lib/python2.7/subprocess.py", line 1463, in _communicate_with_poll ready = poller.poll() KeyboardInterrupt [ERROR]: User interrupted execution
sijeesh commented 6 years ago

Hi @tdovan,

It seems like you are trying to create multiple server profiles using single server hardware. Server hardware can have only one profile assigned to it, go through the below link to understand more about the server profile creation.

http://h17007.www1.hpe.com/docs/enterprise/servers/oneview3.0/cicf/en/content/s_profile_overview-cic.html

I hope this will help.

sijeesh commented 5 years ago

@tdovan, Closing this, as there is no follow up.

tdovan commented 5 years ago

hi, it is possible to reopen this case ? I still have the issue with oneview api version 1000 using this simple yml:

sijeesh commented 4 years ago

@tdovan , Looks like the profile module was not catching the right exception. Use the below branch and let me know if you can create profiles in parallel. https://github.com/HewlettPackard/oneview-ansible/tree/bug_fix/create_profiles_in_parallel