Commit graph

807 commits

Author SHA1 Message Date
mchllweeks
4b48166005
Merge pull request #299 from mattkirby/release_3
Bump version for vmpooler in changelog
2018-09-18 16:55:48 -07:00
kirby@puppetlabs.com
e469739db1 Bump version for vmpooler in changelog 2018-09-18 15:11:19 -07:00
mchllweeks
98a84ab239
Merge pull request #298 from mattkirby/pooler_129
(POOLER-129) Allow setting weights for backends
2018-09-18 11:22:42 -07:00
kirby@puppetlabs.com
b1586393c7 Document backend_weight setting 2018-09-13 09:32:20 -07: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
Spencer McElmurry
258f603048
Merge pull request #296 from mattkirby/bring-the-pitchfork-rebased
(POOLER-114) Refactor check_pool in pool_manager
2018-08-23 16:34:27 -05: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
mchllweeks
c053554ca8
Merge pull request #294 from mattkirby/vmpooler_release_02
(MAINT) release 0.2.0
2018-07-25 08:51:31 -07:00
kirby@puppetlabs.com
79a378f4db (MAINT) release 0.2.0 2018-07-24 16:46:26 -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
mchllweeks
10efddd43e
Merge pull request #292 from mattkirby/remove_mutex_on_destroy
(POOLER-128) Remove references to VM mutex when destroying
2018-07-24 16:18:04 -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
Samuel
10bf6c8816
Merge pull request #290 from steveax/maint-change-domain-to-example.com
(maint) change domain to example.com
2018-07-20 12:10:41 -05:00
Steve Axthelm
c3d90dbfa6 (maint) change domain to example.com
Prior to this commit the docs and examples used 'company.com'
(a real domain). This commit changes those occurrences to
'example.com', which is a IANA-managed reserved domain.
2018-07-19 15:23:30 -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
Kevin Imber
c3bf3aaa49
Merge pull request #288 from mattkirby/release_time
(MAINT) release 0.1.0
2018-07-19 13:09:00 -07:00
Kevin Imber
b738401c62
Merge pull request #289 from mattkirby/docker_updates_gem
Update entrypoint in dockerfile for vmpooler gem
2018-07-19 13:08:27 -07:00
kirby@puppetlabs.com
7623058ae7 Update entrypoint in dockerfile for vmpooler gem
This commit updates dockerfile entrypoint to remove the explicit
vmpooler executable path. Additionally, CMD is added to run a default
command when runtime parameters are not passed in by the user. Without
this change the vmpooler executable path is hardcoded into a directory
that will not exist.
2018-07-17 16:01:22 -07:00
Jenkins
d226a8e9fa (GEM) update vmpooler version to 0.1.0 2018-07-17 22:40:15 +00:00
Jenkins
6c9280ff25 (GEM) update vmpooler version to 0.0.2 2018-07-17 22:34:55 +00:00
kirby@puppetlabs.com
36771e65bc (MAINT) release 0.1.0 2018-07-17 14:48:38 -07:00
Spencer McElmurry
67eb05c2f3
Merge pull request #285 from mattkirby/add_changelog
(doc) Add changelog and contributing guidlines
2018-07-17 14:26:07 -07:00
Spencer McElmurry
c1a8cee16d
Merge pull request #286 from mattkirby/remove_2_2
(maint) Remove ruby 2.2.10 from travis config
2018-07-17 14:24:02 -07:00
Spencer McElmurry
b4fb94aec8
Merge pull request #287 from mattkirby/require_updates
(maint) Fix vmpooler require in bin/vmpooler
2018-07-17 14:23:39 -07:00
kirby@puppetlabs.com
f425996768 (maint) Fix vmpooler require in bin/vmpooler
During a rebase the vmpooler require was mixed up and still specified
lib/vmpooler. This commit removes this as well as the rubygems
requirement. Without this change vmpooler fails to work when built
because it cannot load lib/vmpooler.
2018-07-16 17:16:17 -07:00
kirby@puppetlabs.com
dd6af73abd (maint) Remove ruby 2.2.10 from travis config
This commit removes ruby 2.2.10 from travis configuration. Without this change travis tests fail since vmpooler has dropped ruby 2.2.10 support.
2018-07-16 17:11:30 -07:00
kirby@puppetlabs.com
afd5f87ed6 (doc) Add changelog and contributing guidlines
This commit adds a changelog and contributing guidelines to vmpooler. Without this change vmpooler offers no specific contributing guidelines or changelog.
2018-07-16 16:46:03 -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
4788693749 Update gemspec in preparation for vmpooler release
This commit updates gemspec and Gemfile in preparation of a vmpooler release. To support this change the vmpooler executable is placed into a bin directory for inclusion in the gem. The license in gemspec is updated to Apache 2.0 to reflect the vmpooler project license.
2018-07-14 15:49:58 -07:00
kirby@puppetlabs.com
fcb3880852 Configure vmpooler to run from bin/vmpooler 2018-07-14 15:49:58 -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
d9e1feadea Add documentation for new parameters to example configuration files 2018-07-13 12:24:55 -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