Commit graph

614 commits

Author SHA1 Message Date
Jenkins
a1ec332ffe (TAG) update version to 0.5.0 2019-02-14 20:04:58 +00:00
kirby@puppetlabs.com
3e26a8f998 (POOLER-139) Fix discovering checked out VM
This commit updates how vmpooler retrieves VMs to add a VM to the running queue as soon as it is checked out. Without this change it is possible that a VM can be discovered when it is checked out before it is added to the running queue if multiple systems are requested. Additionally, the dockerfile is updated to support specifying the version of vmpooler to install.
2019-02-13 16:43:55 -08:00
Jenkins
5e4ba2bc7e (TAG) update version to 0.4.0 2019-02-06 23:07:36 +00:00
kirby@puppetlabs.com
49ec06e151 (POOLER-138) Support multiple pools per alias
This change updates handling of pool aliases to allow for more than a
single pool to be configured as an alias pool. Without this change if
multiple pools are configured as an alias the last one to configure it
is set as the alias for that pool.

Additionally, redis testing requirements are removed in favor of
mock_redis. Without this change a redis server is required to run
vmpooler tests.
2019-02-01 09:05:23 -08:00
kirby@puppetlabs.com
d94b14a4d8 (POOLER-137) Support integer environment variables
This commit updates vmpooler to set configuration values received via environment variables to integer values when an integer value is expected. Without this change vmpooler does not support setting integer values via environment variables. Additionally, testing is added for configuring vmpooler via environment variables.

To support this testing the gem climate_control is added, which allows
for testing environment variables without those set variables leaking to
other tests.
2019-01-22 15:02:07 -08:00
Jenkins
ae694c5167 (TAG) update version to 0.3.0 2018-12-20 22:52:00 +00:00
kirby@puppetlabs.com
2de4a6db0b Ensure nodes are consistent for usage stats
This commit updates vm usage stats collection to replace all instances of '.' characters within node strings. Without this change the node string containing a '.' character causes the metric to be interpreted as containing another node.
2018-12-19 12:45:50 -08:00
Jenkins
b4dfbca40e (TAG) update version to 0.2.31 2018-12-10 22:35:08 +00:00
Jenkins
bfc0c24106 (TAG) update version to 0.2.3 2018-12-10 21:06:47 +00:00
kirby@puppetlabs.com
9a57c6d1b5 (POOLER-134) Ship VM usage stats
This commit updates vmpooler to ship VM usage stats when a VM is destroyed. The stats are gathered for jobs based on user and pool name. If a jenkins build URL is present then this is broken down by user, instance, value stream, branch and project. Additionally, if present then the RMM_COMPONENT_TO_TEST_NAME will be listed after project. Without this change we do not collect stats on per VM usage and its correlation to users and pools.
2018-12-07 11:59:27 -08:00
kirby@puppetlabs.com
3c856d7ae9 (POOLER-133) Identify when a ready VM has failed
This commit fixes checking of a VM that has already been identified as ready. Without this change a ready VM that has failed will be identified as having failed, but will not successfully be removed from the ready queue. Additionally, the default vm_checktime value has been reduced from 15 to 1 to ensure that ready VMs are checked within one minute of the time they have reached the ready state by default.

Lastly, the docker-compose files are updated to specify that the redis
instance used is a local redis instance.
2018-12-03 12:21:08 -08:00
kirby@puppetlabs.com
5704488cc5 (POOLER-132) Sync pool size on dashboard start
This commit updates the dashboard for vmpooler to ensure it is synchronized with any redis based configuration values before displaying the dashboard. Without this change the pool size value may be displayed incorrectly if the value has been set via the /config/poolsize API endpoint.
2018-10-03 13:07:20 -07:00
Jenkins
9bc17a8935 (GEM) update vmpooler version to 0.2.2 2018-10-01 23:25:52 +00:00
kirby@puppetlabs.com
4ba4a1dd6c (POOLER-131) Return requested name when getting VMs
This commit updates fetch_single_vm to return the name of the template that was requested, instead of the name of the pool providing the VM to meet the request. Without this change, when an alias is used for fetching a VM, a different pool title may be returned containing the requested VMs than the user initially requested.
2018-09-27 12:05:30 -07:00
Jenkins
5e39bc2755 (GEM) update vmpooler version to 0.2.1 2018-09-19 00:05:01 +00:00
kirby@puppetlabs.com
f5c3c86632 Remove pool_backend method 2018-09-13 09:24:17 -07:00
kirby@puppetlabs.com
830acd705d Remove debug statements. Return when get_vm returns nil 2018-09-12 12:28:12 -07:00
kirby@puppetlabs.com
cd73f53561 (POOLER-129) Allow setting weights for backends
This commit updates get_vm in the vmpooler API to allow for setting weights for backends. Additionally, when an alias for a pool exists, and the backend configured is not weighted, then the selection of the pool based on alias will be randomly sampled. Without this change any pool with the title of the alias is exhausted before an alternate pool with the configured alias is used, which results in an uneven distribution of VMs. When all backends involved are configured with weighted values the VM selection will be based on probability using those weights.

A bug is fixed when setting the default ttl for check_ready_vm.

Pickup is added to handle weighted VM selection.

A dockerfile is added that allows for building and installing vmpooler
from the current HEAD in docker to make for easy testing.
2018-09-11 11:15:02 -07:00
mchllweeks
0e86937245
Merge pull request #297 from mattkirby/pooler_130
(POOLER-130) Improve delta disk creation handling
2018-08-30 17:22:35 -07:00
kirby@puppetlabs.com
3fd0c6f475 (POOLER-130) Improve delta disk creation handling
This commit updates delta disk creation to reduce the likelihood of this being run more than once for any given template. Without this change an error can be generated with vsphere 6.5 or later when a template is updated, and then the update is reverted. The error prevents the image from being used because the template is never marked as prepared. To address this any failure is now logged, and the template is marked as prepared regardless of whether this was successful, or not, which allows the image to be used despite the error. This failure mode is more graceful and allows the pool to continue to function.
2018-08-30 15:50:07 -07:00
Samuel Beaulieu
3aac95d5b9 (POOLER-114) Refactor check_pool in pool_manager
This commit refactorss the check_pool method in pool_manager.
Specifically, each commented section describing a stage of check_pool is
broken out into a separate method and check_pool is simplified by
calling these methods. Without this change it is difficult to follow the
intent for or make changes to check_pool.

Additionally, a docker-compose file is added to make it simple to launch
an all-in-one vmpooler instance along with a separate redis server with
docker.
2018-08-23 14:04:52 -07:00
Jenkins
5733dc3487 (GEM) update vmpooler version to 0.2.0 2018-07-24 23:46:19 +00:00
Corey Osman
2daa5244b8 Adds a new mechanism to load providers from any gem or file path. (#263)
* Adds ability to load only providers used in config file
2018-07-24 16:35:18 -07:00
mattkirby
0a769b8901
Merge pull request #293 from mattkirby/do_not_discover_destroying
Remove VM from completed only after destroy
2018-07-24 16:33:16 -07:00
mchllweeks
295fbb6b64
Merge pull request #291 from mattkirby/improved_docs
(doc) Document config via environment
2018-07-24 16:27:46 -07:00
kirby@puppetlabs.com
90edc6f979 Remove VM from completed only after destroy
This commit updates destroy_vm to remove the redis member from the completed queue only after a destroy has been completed. Without this change a VM that is being destroyed will be logged as discovered when inventory is checked since it has already been removed from the completed queue.
2018-07-24 16:21:59 -07:00
kirby@puppetlabs.com
490e5c1938 (POOLER-128) Remove references to VM mutex when destroying
This commit updates destroy_vm to remove references to its mutex tracking object when destroyed. Without this change a VM that is destroyed will leave its mutex tracking object forever causing the pool manager memory footprint to increase.
2018-07-23 16:53:53 -07:00
kirby@puppetlabs.com
4feb9c62a2 (doc) Document config via environment
This commit adds documentation for specifying vmpooler configuration via environment variables. LDAP server is corrected to LDAP host, and the capability to specify graphite prefix and port is added. Vagrant documentation is moved into its own file to reduce noise in the main readme. Lastly, docker usage is updated to reflect that you no longer bake in a configuration file, and that API and manager can be run separately from docker via its entrypoint.
2018-07-20 15:30:54 -07:00
Kevin Imber
099b53f348
Merge pull request #274 from mattkirby/cleanup_unused_folders_and_vms
(POOLER-66) Purge vms and folders no longer configured
2018-07-19 13:19:13 -07:00
kirby@puppetlabs.com
36771e65bc (MAINT) release 0.1.0 2018-07-17 14:48:38 -07:00
mattkirby
95d9c83479
Merge pull request #281 from mattkirby/pooler_109
(POOLER-109) Allow API to run independently
2018-07-16 16:41:37 -07:00
Spencer McElmurry
5ca85beb18
Merge pull request #283 from mattkirby/remove_find_pool
(MAINT) Remove find_pool and update pending tests
2018-07-16 10:25:16 -07:00
kirby@puppetlabs.com
ff1d288b53 (MAINT) Remove find_pool and update pending tests
This commit removes find_pool, which is no longer used. Additionally, tests which are listed as pending and have been resolved are removed from pending tests. Lastly, a folder check that doesn't make sense given the change in method for finding objects is removed.
2018-07-13 12:42:09 -07:00
kirby@puppetlabs.com
c64a8afc3f Get whitelist from provider_config 2018-07-13 12:09:28 -07:00
kirby@puppetlabs.com
a34c8dd11b (POOLER-66) Purge vms and folders no longer configured
This commit enables optional purging for vms and folders when they are
not configured in the vmpooler provided configuration. Base folders are
determined from folders specified in the pool configuration. Then,
anything not configured in that folder for that provider and is not a
whitelisted folder title will be destroyed. Without this change vmpooler
will leave unconfigured vms and folders behind and any vms will be left
running forever without manual intervention. Additionally, any
associated redis data will never be expired.
2018-07-13 12:09:28 -07:00
mattkirby
070199e877 Eliminate duplicate VM object lookups where possible (#269)
* Minimize duplicate checking of VMs

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.

* Make hostname mismatch checking optional

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.

* Check if a hostname return is empty string

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.

* Only check hostname for mismatch after time since ready has past

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.
2018-07-13 12:06:44 -05:00
kirby@puppetlabs.com
1e63d25b2b Allow vmpooler to run without specifying a configuration file 2018-07-13 09:36:43 -07:00
kirby@puppetlabs.com
b4bae80eeb Set config via env for dashboard spec 2018-07-13 09:35:18 -07:00
kirby@puppetlabs.com
528020fec7 (POOLER-109) Allow API to run independently
This commit updates vmpooler to allow the API component and dashboard to
run separately from pool_manager. Without this change vmpooler does not
offer a mechanism to run only the API, or pool_manager components.

Two instances of hardcoded puma environment settings are removed. This
is still set in the init script explicitly as well as via an environment
variable in the dockerfile.

To extend the mechanism of running the API or pool_manager components to
instances running in docker an entrypoint is added in the dockerfile.
The entrypoint allows a user to specify whether to run the API or
pool_manager components when running the application. The default
behavior is preserved where both components are run.

To support these changes vmpooler.rb is updated to allow more of the
configuration to be specified via individual environment variables. It
was already possible to specify the entire config block as an
environment variable, but this is more difficult to manage and less of a
standard implementation than specifying individual parameters. Where
specified environment variable options will override a value configured
via the configuration file or environment.

The running pool configuration when starting pool_manager is loaded to
redis at pool_manager start time. This allows the API to load the
running pool configuration from redis and be able to run without
requiring the pool configuration.

Lastly, the dockerfile leveraging entrypoint will no longer start
vmpooler with the init script or write logs to a file. Instead, LOGFILE
is set to /dev/stdout and the vmpooler application is started directly.
This behavior is preferred because the log file writes to disk are an
unnecessary overhead. Without this change the docker installation will
attempt to daemonize the vmpooler application and always requires puma.
2018-07-13 09:35:18 -07:00
mattkirby
7e5ef2f4e5
Merge pull request #264 from logicminds/gemspec
Adds a gemspec file
2018-07-13 09:23:11 -07:00
Spencer McElmurry
12bba418d1 (POOLER-81) Add time remaining information (#280)
* (POOLER-81) Add time_remaining information

Before, the only time calculation displayed for a given VM was the
lifetime parameter. Added the remaining parameter which will
display time until the VM is destroyed as a float.

Additionally, start_time and end_time were added to api to return
as UTC based times (e.g. 2018-07-10 11:01:03 -0700).

* Remove abs eval from GET, rework spec tests to check each field.
This allows us to account for "flakiness" of the remaining return.

* Change datetime to RFC3339 for start_time and end_time
2018-07-12 09:40:22 -07:00
Spencer McElmurry
84065dd059 Revert "(POOLER-81) Add time_remaining information" (#279)
* Revert "(POOLER-34) Ship clone request to ready time to metrics (#277)"

This reverts commit a865e6bd2f.

* Revert "(POOLER-81) Add time_remaining information (#276)"

This reverts commit 1910cffaf7.
2018-07-10 09:00:12 -07:00
Spencer McElmurry
a865e6bd2f (POOLER-34) Ship clone request to ready time to metrics (#277)
* (POOLER-34) Ship clone request to ready time to metrics

Before, we were already capturing this metric but we failed to ship
it anywhere. This ships the appropriate metric as `time_to_ready_state`
Dashboards can be found in grafana.

* Add spec test to ensure metric is being shipped properly on
move_pending_vm_to_ready call.
2018-07-09 16:22:49 -07:00
Spencer McElmurry
1910cffaf7 (POOLER-81) Add time_remaining information (#276)
* (POOLER-81) Add time_remaining information

Before, the only time calculation displayed for a given VM was the
lifetime parameter. Added the time_remaining parameter which will
display time until the VM is destroyed in hours, minutes, seconds.

Additionally, updated the running parameter to display in a similar
fashion as time_remaining.

* Add spec testing for testing time_remaining stat
2018-07-09 16:22:05 -07:00
mchllweeks
6f4f3cc4e7
Merge pull request #273 from mattkirby/pooler_124
(POOLER-124) Fix evaluation of max_tries
2018-07-09 12:50:34 -07:00
mchllweeks
afc5a33d8f
Merge pull request #272 from mattkirby/pooler_40
(POOLER-40) Do not return folders with get_pool_vms
2018-07-09 12:50:00 -07:00
mchllweeks
2f98b1bd7a
Merge pull request #271 from mattkirby/less_delta_disks
Ensure template deltas are created once
2018-07-09 12:49:08 -07:00
mchllweeks
69f8b21ca8
Merge pull request #270 from mattkirby/no_duplicate_vms_in_pool
Do not run duplicate instances of inventory check for a pool
2018-07-09 12:48:41 -07:00
mchllweeks
a72012b754
Merge pull request #268 from mattkirby/reduce_object_lookups
Reduce object lookups for finding folders
2018-07-09 12:46:17 -07:00
kirby@puppetlabs.com
faaec4f9bc (POOLER-124) Fix evaluation of max_tries
This commit updates usage of max_tries to ensure that the increment of the try value happens after evaluation of whether max_tries has been exceeded. Without this change max_tries doesn't work as advertised. Additionally, checking looks to see if try is greater than or equal to so the try count exceeding max_tries would also be detected.
2018-07-03 11:24:05 -07:00