Commit graph

756 commits

Author SHA1 Message Date
Michelle Schuknecht
ce4be86486 (POOLER-114) Fixed more pool_manager_spec tests 2018-07-24 11:37:17 -07:00
kevpl
1c8728b9b2
(MOB) cleared up some tests
helped some repopulate tests, needed
refactoring for the clone_vm method
which broke its own tests. Yay
2018-07-24 11:05:50 -07:00
kirby@puppetlabs.com
6449f1aab1 Fix number of ends at end of file. Move update_pool_size out of repopulate_pool_vms. Remove instances of check_pool_vms within the test. 2018-07-24 10:41:46 -07:00
Spencer McElmurry
f45efb1b86 Moved repopulate pool vms method, broke loads of spec tests. Good luck 2018-07-24 10:06:47 -07:00
Dakota Schneider
d9519a1931 (POOLER-114) Minor cleanup of #check_X_pool_vms specs 2018-07-24 09:40:56 -07:00
Dakota Schneider
c3e4ed7ffd (POOLER-114) Fixup spec tests for #check_migrating_pool_vms 2018-07-24 09:38:05 -07:00
Spencer McElmurry
5322d715b3 Add discovered and partly migrating VM definitions. Spec tests
still failing.
2018-07-17 11:51:41 -07:00
kevpl
83f037c5b7
(MOB) completed refactor (in progress) 2018-07-17 11:19:19 -07:00
Dakota Schneider
4610c2e1ee refactor #check_pending_pool_vms spec tests 2018-07-17 10:46:37 -07:00
Samuel Beaulieu
fdb8a45faa refactor PENDING section in check pool 2018-07-17 12:06:51 -05:00
Michelle Schuknecht
dc9b221bb9 fixed pool_manager_spec tests 2018-07-17 09:36:15 -07:00
kirby@puppetlabs.com
481d5b215f (MOB) Running tests pass
Good luck ready tester
2018-06-29 15:50:06 -07:00
Spencer McElmurry
b9d86c85ec Fixed spec testing for check_running_pool_vm 2018-06-29 15:13:44 -07:00
Dakota Schneider
cd8a87560f (MOB) "Good luck" 2018-06-29 14:49:04 -07:00
kevpl
5cfc4ed3bb
(MOB) refactored check_running_pool_vms method
Some test fixing came along with this
2018-06-29 13:58:26 -07:00
Dakota Schneider
37e137962a Resolve merge conflicts from upstream rebase 2018-06-29 13:24:23 -07:00
kirby@puppetlabs.com
fa988470a7 Pass pool_check_response to create_inventory
Ensure that pool_check_response is passed in to create_inventory. Start base for running pool vms.
2018-06-29 13:09:23 -07:00
kevpl
ec07f04d95 (MOB) refactor create_inventory into own method
Takes the #INVENTORY section from
the _check_pool method & splits
it into its own method
2018-06-29 13:09:23 -07:00
Samuel Beaulieu
678290f779 Adding a docker compose for local dev
Changed the dummy example file to match the expected LOG location
2018-06-29 13:09:23 -07:00
mchllweeks
8be578493a
Merge pull request #267 from mattkirby/multiple_ldap_search
(POOLER-113) Add support for multiple LDAP search bases
2018-06-27 15:26:49 -07:00
kirby@puppetlabs.com
4fa54c8008 Move net/ldap require into vmpooler.rb
This commit moves net/ldap require from authenticate_ldap in api/helpers to vmpooler.rb. Without this change net/ldap and rubygems are required again every time authenticate_ldap is run.
2018-06-27 15:21:15 -07:00
kirby@puppetlabs.com
cbd4567454 Provide valid configuration for auth
This commit removes a additional authenticate method that is defined in the token_spec tests. Instead, authenticate is used from api/helpers. To support this change the config provided is updated to specify a dummy provider. Without this change authenticate cannot be tested along with token_spec because token_spec redefines authenticate.
2018-06-27 14:41:27 -07:00
kirby@puppetlabs.com
9fa27af8e5 (POOLER-113) Add support for multiple LDAP search bases
This commit updates vmpooler to support setting an array of search bases
in addition to a single base provided as a string. Without this change
it is not possible to specify multiple search bases to use with the LDAP
authentication provider. Additionally, test coverage is added to
the authentication helper method.
2018-06-25 21:37:22 -07:00
mchllweeks
de813943e9
Merge pull request #265 from mattkirby/destroy_once
(POOLER-112) Ensure a VM is only destroyed once
2018-06-20 13:51:43 -07:00
kirby@puppetlabs.com
3a0f0880e7 (POOLER-112) Ensure a VM is only destroyed once
This commit implements a vm_mutex hash to allow synchronizing VM operations that should only happen once across threads. Without this change pool_manager will try to evaluate or destroy a VM multiple times, which results in an error being thrown by one of the destroy attempts as only one can succeed and a duplication of resources unnecessarily when there are no errors.
2018-06-20 13:40:49 -07:00
Samuel
89e1f17738
Merge pull request #261 from mattkirby/fix_ignore_cert
Change default vsphere connection behavior
2018-06-20 15:27:40 -05:00
Samuel
d736b1e978
Merge pull request #260 from mattkirby/fix_check_disk
Remove propertyCollector from add_disk
2018-06-20 15:25:38 -05:00
Samuel
63fb23154c
Merge pull request #256 from mattkirby/config_changes_squash
(POOLER-107) Add configuration API endpoint
2018-06-20 15:23:44 -05:00
Dakota Schneider
8c79acd02d Fixup spec for pool_check_response 2018-06-19 11:52:40 -07:00
kirby@puppetlabs.com
a78d65137d Pass pool_check_response to create_inventory
Ensure that pool_check_response is passed in to create_inventory. Start base for running pool vms.
2018-06-19 11:27:47 -07:00
kevpl
03a16a1a4d
(MOB) refactor create_inventory into own method
Takes the #INVENTORY section from
the _check_pool method & splits
it into its own method
2018-06-19 11:00:16 -07:00
Samuel Beaulieu
987cdcdee3 Adding a docker compose for local dev
Changed the dummy example file to match the expected LOG location
2018-06-19 11:51:29 -05:00
kirby@puppetlabs.com
9bb4df7d8e (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.

A table of contents is added to API.md to ease navigation. Without this change API.md has no table of contents and is difficult to navigate.

Add mutex object for managing pool configuration updates

This commit adds a mutex 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.

Add wake up event for pool template changes

This commit adds a wake up event to detect pool template changes.
Additionally, GET /config has a template_ready section added to the
output for each pool, which makes clear when a pool is ready to populate
itself.
2018-06-15 10:15:47 -07:00
mattkirby
e781ed258b Update ruby versions for travis (#259)
This commit updates ruby versions specified for use when testing in
travis.yml. Specifically, ruby 2.4.x and 2.5.x are added, while 2.2 is
updated to 2.2.10, and 2.3 is updated to 2.3.7. Additionally, jruby
testing is updated to use 9.1.17.0. Without this change we do not test
ruby 2.4.x or 2.5.x with vmpooler.
2018-06-14 15:21:35 -05:00
Spencer McElmurry
c77e0c4c65
Merge pull request #257 from mattkirby/redis_port_password
Add support for setting redis port and password
2018-06-13 09:08:04 -07:00
kirby@puppetlabs.com
af8b73b6c9 Change default vsphere connection behavior
This commit changes the vsphere connection behavior to set insecure false. Without this change insecure is always set to true when making a connection regardless of the setting provided with the provider configuration.
2018-06-08 12:40:03 -07:00
FrozenFOXX
65fb4c9919 Update to generic launcher
I realized the launcher itself handles looking up the Ruby interpreter with /usr/bin/env ruby. Manually specifying an interpreter is going to try to circumvent that and isn't nearly as portable as an example service. By moving this sample script back to the generic launcher directly a user can choose to handle how /usr/bin/env looks up Ruby, whether it's with a jruby installation, rbenv, or however the user wishes.
2018-06-08 12:10:44 -07:00
kirby@puppetlabs.com
d1ae85c8af Remove propertyCollector from add_disk
This commit updates add_disk to remove propertyCollector, which was used
to back the find_vmdks method to locate the disk file on datastore and
then use its length to name the new disk. Instead, the number of disks
on the VM is used to ensure a unique disk resource title. Without this
change add_disk can take 10-50x longer due to the propertyCollector
method. Additionally, without this change propertyCollector is used in a
non threadsafe manner, which may cause stability issues for vsphere
provider backends.
2018-06-04 11:51:55 -07:00
kirby@puppetlabs.com
9b8b35395d Add dockerfile without redis
This commit adds a dockerfile to install vmpooler without a local redis installation. Without this change the dockerfile provided assumes a local redis instance will be running. The dockerfile with redis is retained as 'Dockerfile-aio'. Additionally, the directory '/var/log/vmpooler' is no longer created since vmpooler uses '/var/log/vmpooler.log'.
2018-05-30 12:19:05 -07:00
FrozenFOXX
67d5ef73c2 Adjusted with jruby
Since the new recommended way to run is with JRuby I've adjusted the startup service to reflect that.
2018-05-30 12:18:49 -07:00
FrozenFOXX
f69e9398c1 Create vmpooler.service 2018-05-30 12:18:49 -07:00
kirby@puppetlabs.com
a9ca914832 Add support for setting redis port and password
This commit adds options for setting redis port and password. Without this change it is not possible to specify the redis port or password.
2018-05-30 12:18:05 -07:00
Spencer McElmurry
3e8f5eb031
Merge pull request #251 from mattkirby/fix_heavy
(POOLER-68) Replace find_vm search mechanism
2018-05-29 11:31:09 -07:00
kirby@puppetlabs.com
4700ad2bb8 (POOLER-68) Replace find_vm search mechanism
This commit replaces find_vm and find_vm_heavy with a more performant and reliable mechanism of identifying VM objects. Specifically, FindByInventoryPath is able to leverage known data about a VM, its folder path and datacenter, and use that to identify whether that VM exists by its location. Without this change find_vm_heavy is called each time a VM cannot be found, which is frequent, and in doing so uses PropertyCollector in a manner that is not thread-safe. Additionally, this PropertyCollector usage does not clean up its traces, which can cause vCenter appliance instability issues on VCSA 6.x.
2018-05-14 09:12:20 -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