The problem is that the method enumerates all hosts that match the HOST_SORT_ORDER list before it matches against tagged groups. The default is:
HOST_SORT_ORDER = [:active_provioning_memory, :current_memory_headroom, :random]
…and it’s the
:current_memory_headroom value that takes the time. With this set the method calls the
current_memory_headroom method on each host object, and this makes a call to vCenter to pull back the real-time memory utilisation for the host. I’ve seen a busy vCenter take 30 seconds or so to respond to each of these method calls. Multiply this by your number of hosts, and that’s where your timeout is.
The simplest workaround is probably to remove
:current_memory_headroom from the HOST_SORT_ORDER list, i.e.
HOST_SORT_ORDER = [:active_provioning_memory, :random]
Hope this helps,