Skip to content

Eliminate duplicate VM object lookups where possible#269

Merged
sbeaulie merged 4 commits into
puppetlabs:masterfrom
mattkirby:less_duplicate_checking
Jul 13, 2018
Merged

Eliminate duplicate VM object lookups where possible#269
sbeaulie merged 4 commits into
puppetlabs:masterfrom
mattkirby:less_duplicate_checking

Conversation

@mattkirby

Copy link
Copy Markdown
Contributor

This change eliminates a secondary layer of VM object retrieval when checking VM state. Check_pool gathers an inventory of known VMs and then only runs checks for pending, ready and running VMs on instances it has validated as existing in the inventory. As a result it is wasteful to run get_vm and check these objects for a second time. Where possible this checking is removed and configured to run less frequently. For VM hostname mismatch checking an option is added to allow a user to turn this off per pool or globally. Without these changes vmpooler will take significant amounts of memory when configured to run many VMs across many pools due to a large number of object lookups.

@junebug-spencer junebug-spencer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a rebase before we can :shipit:

This commit updates check_pool pending, running and ready methods to greatly reduce instances in which the VM object is retrieved. Without this change get_vm is run for each of these check_pool steps even though the VM is already validated as being in inventory being running the check. This is left for checking running VMs when the VM is no longer ready. Without this change there is an unnecessarily large volume of VM object checks.
This commit makes hostname mismatch checking optional on a pool and global config level. The default behavior of checking this is preserved. When disabled _check_ready_vm will not run get_vm, which allows for ready VMs to be checked without retrieving an object from vsphere and waiting for a free provider connection. Without this change it is not possible to disable VM object retrieval in _check_vm_ready.
This commit checks whether a hostname returned is an empty string.
Without this change a VM that returns a hostname with a empty string
will report as having a hostname mismatch, which may happen before all
VM data is updated.
Configure hostname checking so it is not checked until a VM has been
ready for greater than one minute. Without this change hostname checking
will often fail because the configured value has not propogated to the
VM on some platforms before this check is run.
@mattkirby mattkirby force-pushed the less_duplicate_checking branch from 4768797 to c6020e9 Compare July 12, 2018 00:23
@mattkirby

Copy link
Copy Markdown
Contributor Author

I have rebased this.

@sbeaulie sbeaulie merged commit 070199e into puppetlabs:master Jul 13, 2018
quorten added a commit to quorten/vmpooler that referenced this pull request Aug 30, 2019
The host['boottime'] variable in the function _check_ready_vm no longer
has its parent object in reference due to the refactoring in pull
request puppetlabs#269.  So in order to get the same information without the
performance impact from duplicate object lookups, we get similar
information from the time that the VM is ready.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants