Open Akasurde opened 4 years ago
From @sky-joker on Mar 26, 2020 09:28
Hi @markatdxb
Thank you for this reporting!
The Ansible VMware modules have moved into Collections.
Could you please re-create this issue the following repo.
Hello, I just wrote this test playbook - first time I use collections so hope syntax is OK. Result in terms of the module performance is the same :(
---
- name: VMware test playbook
hosts: localhost
gather_facts: no
collections:
- community.vmware
vars:
vm_name: 'TESTVM'
vcenter_hostname: xxxx
vcenter_username: 'xxxx'
vcenter_password: 'xxxx'
tasks:
- name: Find VM
vmware_guest_find:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
name: '{{vm_name}}'
register: vm_out
ignore_errors: yes
- debug:
var: vm_out
@markatdxb I am naive in PowerShell, so can't say about its performance over Pyvmomi
. But, I definitely agree that there is a lot of room for performance improvement in vmware_guest_find
.
@markatdxb Can you please suggest something which you think will improve the performance? also, could you please provide the mentioned powershell that you use which provides the exact result?
@Akasurde - honestly I don't know how the Pyvmomi is written, I'm not a programmer on that level but rather an active Ansible user so I cant suggest what can be improved here. In terms of Powershell. With installed PowerCLI - command look like this
$cred = Get-Credential
Connect-VIServer -Server vCentername -Credential $cred -Force
Get-VM -Name VMNAME
This one basically returns the information about the VM within a few seconds the most
I've tried to have a look into this issue but can't reproduce it. We don't have 4000+ VMs, but I've tested with a vCenter that manages between 1300 and 1400 VMs and the module takes around 5 seconds. I would be really surprised if going from 1300+ to 4000+ VMs would increase the time from seconds to minutes.
@Akasurde You say that you definitely agree that there is a lot of room for performance improvement
, does that mean you can reproduce this issue?
@markatdxb Btw: Why do you ignore_errors
?
@mariolenz - we added ignore_errors as when we do search, we basically dont know if the VM exists or not in our environment, This part of our server decommission process where we test if server is VM or Physical HW, and pull VM location
cc @Tomorrow9 @goneri @lparkes @pgbidkar @warthog9 click here for bot help
Can you give a try to the new vmware.vmare_rest.vcenter_vm_info
module. It should be much faster. The inventory plugin should also offer better performance.
https://docs.ansible.com/ansible/devel/scenario_guides/vmware_rest_scenarios/vm_info.html
waiting_on_contributor
My use case for vmware_guest_find
is to retrieve the folder path to a target guest VM.
From the docs, it doesn't look like vmware.vmware_rest.vcenter_vm_info
provides this information.
Is there any other call that will retrieve the full folder path to a guest? This one is still really slow.
From @markatdxb on Mar 26, 2020 08:19
SUMMARY
running vmware_guest_find takes extensive long time - in out environment with 4000+ VMs it takes around 7 minutes to get the results. Running for example PowerCLI query takes a second to get the result. Is there any way to improve the performance of this module for large environments?
ISSUE TYPE
COMPONENT NAME
vmware_guest_find
ADDITIONAL INFORMATION
Copied from original issue: ansible/ansible#68484