Eliminate duplicate VM object lookups where possible#269
Merged
Conversation
junebug-spencer
approved these changes
Jul 10, 2018
junebug-spencer
left a comment
Contributor
There was a problem hiding this comment.
Needs a rebase before we can ![]()
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.
4768797 to
c6020e9
Compare
Contributor
Author
|
I have rebased this. |
sbeaulie
approved these changes
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.