Commit graph

718 commits

Author SHA1 Message Date
kirby@puppetlabs.com
6cf12a157e Add invalid templates to result when invalid templates are provided to config endpoint 2018-05-24 11:36:06 -07:00
kirby@puppetlabs.com
ab0c5b53a0 Add get endpoint for config 2018-05-24 11:36:00 -07:00
kirby@puppetlabs.com
c8426b0076 Fix up tests to pass with additions 2018-05-23 13:56:22 -07:00
kirby@puppetlabs.com
ddecb8b8d0 Add mutex object for managing pool configuration updates
This commit adds a config_changes object for ensuring that pool configuration changes are synchronized across multiple running threads, removing the possibility of two threads attempting to update something at once, without relying on redis data. Without this change this is managed crudely by specifying in redis that a configuration update is taking place. This redis data is left so the REPOPULATE section of _check_pool can still identify when a configuration change is in progress, and prevent a pool from repopulating at that time.
2018-05-23 13:37:17 -07:00
kirby@puppetlabs.com
2d679168d7 Add table of contents to API.md
This commit adds a table of contents to API.md. Without this change
API.md has no table of contents and is difficult to navigate.
2018-05-22 17:01:16 -07:00
kirby@puppetlabs.com
9758adccfe (POOLER-107) Add configuration API endpoint
This commit adds a configuration endpoint to the vmpooler API. Pool
size, and pool template, can be adjusted for pools that are configured
at vmpooler application start time. Pool template changes trigger a pool
refresh, and the new template has delta disks created automatically by
vmpooler.

Additionally, the capability to create template delta disks is added to
the vsphere provider, and this is implemented to ensure that templates
have delta disks created at application start time.

The mechanism used to find template VM objects is simplified to make the flow of logic easier to understand. As an additional benefit, performance of this lookup is improved by using FindByInventoryPath.
2018-05-22 17:01:13 -07:00
kirby@puppetlabs.com
00970ffc9e (POOLER-103) Fix configuration file loading
This commit updates the method used to load a configuration file to use
YAML.load_file, which is how it was configured previously. The
capability to specify an alternate configuration file via the
VMPOOLER_CONFIG_FILE is retained, and now works as expected.
2018-05-11 17:49:14 -07:00
kirby@puppetlabs.com
356c541fdc (POOLER-101) Update nokogiri and net-ldap
This commit updates nokogiri and net-ldap to versions that have fixed known vulnerabilities. Without this change vmpooler requires versions of each gem that contain known vulnerabilities.
2018-05-11 17:48:53 -07:00
Samuel Beaulieu
10245321bf (maint) Add the last boot time for each pool
This commit add a redis hash where there is one key per pool, and the
stored value is the last time a VM was booted e.g. the last time
a VM went from 'pending' to 'ready'. This is also displayed in the
API as lastBoot:'2018-03-23 17:43:39 +0000'. The data can then be
used by any external system, in this case our alarming system.
2018-03-28 11:11:49 -07:00
David Bishop
d57fc72fdb Fix typo in error message 2018-01-25 08:59:00 -08:00
adamdav
878c93f646 Allow user to specify a configuration file in VMPOOLER_CONFIG_FILE
variable

Previously, there were two ways to configure Vmpooler, either by
changing the contents of vmpooler.yaml or by assigning the raw YAML
to the VMPOOLER_CONFIG environment variable. This commit adds a new
environment variable called VMPOOLER_CONFIG_FILE that can be assigned
the name of a config file to use. Also fixes #240 by whitelisting the
Symbol class when calling YAML.safe_load in Vmpooler.config.
2018-01-23 15:51:10 -08:00
kirby@puppetlabs.com
28922df28e Remove references to jruby 1.7
This commit removes references to jruby 1.7 and ruby 2.0 in Gemfile. Without this change there are references to unused ruby versions.
2018-01-11 11:04:42 -08:00
kirby@puppetlabs.com
82f141793b Update jruby version for travis to 9.1.13.0
This commit updates travis configuration to replace jruby 1.7.13 with 9.1.13.0. Without this change the jruby version tested is out of date and does not support features like safe_load, which affects issue #243.
2018-01-11 11:04:42 -08:00
kirby@puppetlabs.com
ea9deddd2d Identify when ESXi host quickstats do not return
This commit updates cpu_utilization_for and memory_utilization_for to detect when quickstats are not present. Without this change a nil result is transformed to 0, which is perceived as a host that has no utilization.
2018-01-10 12:17:16 -08:00
kirby@puppetlabs.com
6ab2e2ff8c Add tests for new vsphere functionality
This commit adds tests for the remaining new vsphere functionality.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
ecae6a1a58 reduce loop delay when waiting for host selection 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
fedb3632f2 Simplify run_select_hosts 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
021633cd49 Ensure vm is removed from migrations 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
048ab4433a Remove unnecessary rescue
This commit removes an unnecessary rescue that results in duplicate clone error messages. Without this change clone failures due to unavailable host resources are logged twice. A log message is added to specify the host the VM is running on when migration_limit is not set and migration is disabled. Lastly, when a migration fails it reports the host the VM is running on in addition to the reason for the failed migration.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
82b9033e83 Document parameters added in vmpooler.yaml.example
This change documents new vshpere specific parameters introduced related
to host selection and folder creation. Without this change these paremeters are not
documented.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
67798ab892 Write check_time_finished whether host retrieval was successful or not
This commit updates host selection to write check_time_finished whether
host retrieval was successful or not. Without this change when host
selection fails threads waiting for host selection to complete will
stuck waiting because check_time_finished doesn't update. Additionally,
because it would leave checking => true it would not attempt to inspect
and run host selection again.

Host selection for clones and migrations now make clear that no hosts
are available and fail logging a message. Without this change both
migrations and clones would fail with cryptic error messages logged
indicating clone and migrations failed.

Additionally, this change makes max_age configurable so a user can
specify that host selection should happen more or less frequently, as
required for migrations or clone operations when host selection is
enabled.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
a3516d4913 Specify that migration_limit is vsphere only 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
6175fd591f Remove attr_reader for provider_hosts 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
e92ae559f5 Remove references to redis in migrate_vm 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
0efb79a133 Move provider_hosts to vsphere provider
This commit updates the providers to move provider_hosts under the vsphere provider, which is the only place it's applicable. Methods where redis is passed through are updated to remove this pass through and use the globally available redis object, where applicable. Remove_vmpooler_migration_vm method is not needed and is removed.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
cd979fc24d Move migrate_vm logic to vsphere provider
This commit moves the migrate_vm logic to the vsphere provider. Without
this change migrate_vm has lots of vsphere specific logic in
pool_manager migrate_vm method.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
23242a7b1c Update pool_manager and vsphere tests to support changes in host selection 2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
3050a22d62 Return the least used set of hosts
This commit updates cluster host resource inspection to stop weighting memory as a part of the results. Additionally, instead of returning a single least used host a percentage of the eligible hosts with below average utilization are selected. Without this change host migration logic can cause cluster resource imbalances due to a single host being targeted for many migrations before the impacts of the migrations cause numbers to adjust.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
cd46eea13e Only specify cluster for clone operations
This commit updates create_vm to target a cluster instead of an individual host for clone operations. Without this change cluster host utilization needs to be inspected for everyone clone operation.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
2ffada72b6 Add capability to create folders
This commit adds the capability to create folders within an existing target folder. Without this change folders to support platforms targets need to be created manually.
2018-01-10 12:02:58 -08:00
kirby@puppetlabs.com
ada79e81f4 (QENG-5305) Check cluster utilization once at a time
This commit adds a global provider_hosts concept in order to allow checking cluster utilization once per interval for a given cluster and retain the results, reusing them for an interval, and tracking the least used set of hosts. Without this change each migration and clone operation inspect host utilization and state for each host in the cluster, which is computationally expensive for vsphere.
2018-01-10 12:02:58 -08:00
Samuel
62643b237f (POOLER-96) Setting the Rubygems version (#246)
* (POOLER-96) Setting the Rubygems version

travis uses the latest bundler 1.16 which installs the newer rubygems and I think that might be why it's failing now when downgrading only bundler to version 1.12
This is a test to see if travis will pass.

* also update bundler to 1.15.4

* Update .travis.yml

* update jruby to 1.7.13

* print bundle version

* specify bundler version 1.15.4
2017-11-28 10:43:45 -08:00
Rob Braden
1ff78b4ae2
Merge pull request #237 from puppetlabs/vagrant-update
Updated Vagrant box and associated docs
2017-11-07 15:11:25 -08:00
e075330b76
Updated Vagrant box and associated docs 2017-10-25 14:39:15 -07:00
mattkirby
c958f5787e Merge pull request #245 from puppetlabs/POOLER-93
(POOLER-93) Extend API endpoint to provide just what is needed
2017-10-25 10:06:40 -07:00
Samuel Beaulieu
96541729fb (POOLER-93) Extend API endpoint to provide just what is needed
The status endpoint provides a lot of statistics. This commit extends it
by supporting a query parameter called 'view' which may contain one or
multiple comma separated names for the top-level statistics returned
in the JSON response. status is always returned.
Optional elements are capacity,queue,clone,boot,pools
Everything is returned when 'view' is not specified, which is
backwards compatible with the current behavior.
2017-10-20 15:53:40 -05:00
mattkirby
abdc86f164 Merge pull request #244 from puppetlabs/POOLER-92
(POOLER-92) Add the alias information in the API status page for each…
2017-10-20 09:07:25 -07:00
Samuel Beaulieu
f6813f75c2 move the dummy provider with aliases to the example directory 2017-10-19 16:28:11 -05:00
Samuel Beaulieu
f10bcadf7e (POOLER-92) Add the alias information in the API status page for each pool
Before this change if a pool had an alias configured, the information would not be
made public in the API. This commit adds the alias key in the pool object for each
pool if configured. The alias key can be abscent, a string or an one or multiple
array of strings. The value of the alias is copied from the configuration and can
represent another name for the pool, or another configured pool.
2017-10-18 12:28:51 -05:00
Samuel
0b5abd9bd3 Fix no implicit conversion to rational from nil (#239)
* Fix no implicit conversion to rational from nil
Before this change if the boottime was nil, the check_ready
loop would exit on Time.now - host['boottime'] with a TypeError
in jruby. The boottime is nil when the power is Off so moving that check
earlier should catch that bug.

* set test data properly
2017-10-17 17:51:02 -05:00
mattkirby
be61501260 Merge pull request #236 from glennsarti/make-check-pool-more-responsive
(GH-226) Respond quickly to VMs being consumed
2017-09-26 13:32:52 -07:00
Glenn Sarti
0840e11e71 (maint) Pin nokogiri and redis due to old ruby versions
Nokogiri and Redis gems have had recent releases which are not compatible with
older ruby versions.  This commit modifies the Gemfile to get the latest of
each of these gems on modern ruby versions and pin to the older gem versions for
older ruby engines.
2017-09-19 16:42:51 -07:00
Glenn Sarti
f209c2b830 (GH-226) Respond quickly to VMs being consumed
Previously in commit 9b0e55f959 the looping period was changed from a static
number to a dynamic one depending on load, however this meant that the operation
to refill a pool was slowed down somewhat.  While not a problem under normal
loads, when a pool was quickly consumed, the pool manager may not respond
quickly enough to refill the pool.  This commit:

- Changes the sleep method, to us a helper sleep method that will wakeup
  periodically and evaluate other wakeup events.  This could be used later to
  exist sleep loops when pooler is shutting down to stop blocking threads
- By default the wakeup_period is set to the minimum pool check loop time, thus
  emulating the behaviour prior to commit 9b0e55f959
- Adds tests for the behaviour
2017-09-05 21:41:32 -07:00
mattkirby
0ea1e50267 Merge pull request #234 from mattkirby/config_issues
(POOLER-89) Identify when config issue is present
2017-08-17 12:05:10 -07:00
kirby@puppetlabs.com
2f5e43284d (POOLER-89) Identify when config issue is present
This commit adds vmpooler inspection of configuration issues to host
selection. Specifically, configIssue is checked, which should allow an
issue like quickstats not being reported to be identified even when the
alarm will not trigger. Without this change a host will continue to be
used if quickstats are not reported when alarms are not triggered
because of this condition, which results in a single host being the
target for all deploys and migrations, overloading the host and causing
its VMs to have degraded performance.
2017-08-15 10:58:37 -07:00
mattkirby
03e8933d2b Merge pull request #233 from puppetlabs/fix-template-delta-script
(maint) Update template delta script for moved vsphere credentials
2017-08-02 15:02:30 -07:00
Scott Garman
3efce8d4e7 (maint) Update template delta script for moved vsphere credentials
The vmpooler.yaml file has been reorganized a bit and now nests the
vsphere credentials within a "providers" class. This tweak is needed
to keep the template delta script working.
2017-08-02 14:48:11 -07:00
mattkirby
d789dfdfc8 Merge pull request #229 from glennsarti/fix-phantom-vms
(maint) Remove phantom VMs that are in Redis but don't exist in provider
2017-08-01 10:38:25 -07:00
Rob Braden
0e05163825 Merge pull request #231 from glennsarti/dynamically-load-providers
(GH-230) Dynamically load VM Providers
2017-07-25 15:08:55 -07:00
Rob Braden
d7adb5aee0 Merge pull request #232 from glennsarti/fix-rubocop
Fix rubocop
2017-07-25 15:06:42 -07:00