Commit graph

642 commits

Author SHA1 Message Date
Glenn Sarti
a276542098 (maint) Ignore the crashing WordArray cop in rubocop
Previously the Style/WordArray cop was crashing in the following fil:
lib/vmpooler/api/helpers.rb

This commit disables this cop until the root cause can be determined.
2017-03-16 16:00:32 -07:00
Glenn Sarti
04c91588af (maint) Update Rubobop Todo for 16th March
Quite a few rubocop violations have been resolved.  This commit updates the
rubocop todo file to reflect this.
2017-03-16 15:43:18 -07:00
Glenn Sarti
885d8d2b1c (maint) Add additional rubocop exceptions
This commit adds the following exceptions:

- Style/EmptyMethod
  Methods which are empty are typically supposed to not spread over two lines
  however this is a matter of readability and should not be considered a
  violation
- Metrics/BlockNesting
  Due to a legacy codebase there are instances where the block depth is quite
  high.  Ignore these violations for the time being.
2017-03-16 15:41:02 -07:00
Glenn Sarti
06100ddea6 (maint) Fix rubocop violations
This commit fixes minor rubocopy violations in eleven source files.  Minor
violations are those that include formatting, single quotes, and recently added
classes.
2017-03-16 15:39:15 -07:00
Glenn Sarti
88052ac85a (POOLER-73) Update find_folder in vsphere_helper.rb to enable testing
Previously, it was not able to mock objects to impersonate a RbVmomi::VIM::Folder
object.  This commit changes the case statement to an if statement using is_a?
which can be mocked and allow mocked objects to mimic real objects.
2017-03-14 13:05:30 -07:00
mattkirby
42b7d2d222 Merge pull request #200 from glennsarti/fix-vsphere-credential
(maint) Fix credentials in vsphere_helper
2017-03-14 11:10:33 -07:00
mattkirby
7d82716ad5 Merge pull request #190 from glennsarti/ticket/master/POOLER-73-begin-vsphere-migrate
(POOLER-70) Prepare to refactor VSphere code into a VM Provider
2017-03-14 07:18:33 -07:00
Glenn Sarti
c724d90d90 (POOLER-70) Add initial VSphere VM Provider
This commit adds a skeleton VM Provider for VSphere based VM operations.
2017-03-08 17:14:52 -08:00
Glenn Sarti
ac8a34de86 (POOLER-70) Rename the use of vsphere to provider
VM provisioning will be handled by VM Providers.  This commit renames the use of
vsphere to provider where appropriate and changes the per-pool helper from
vsphere to providers to more accurately represent it's intended use.
2017-03-08 17:14:52 -08:00
Glenn Sarti
c502f92cd3 (POOLER-70) Add initial VM Provider service
Previously all of the VM provisioning code was intertwined with the VM lifecycle
code e.g. The VSphere specific code is mixed with Redis code.  This makes it
impossible to add aditional providers or disable VSphere integration.  This
commit begins the process to refactor the VSphere code out of the lifecycle code
by introducing the concept of VM Providers.  A Provider will contain the logic/
code to manage VMs i.e. create/destroy/inquire.  Therefore the Pool Manager can
query a strict interface into one or more Providers.  Initially only a VSphere
provider will be available.

This commit adds the base class for all providers and describes the API or
contract that the Pool Manager will use to manage VMs.
2017-03-08 17:14:12 -08:00
Glenn Sarti
0e0e1c2fac (maint) Fix credentials in vsphere_helper
In commit 03ad7bfa46 the global variables for credentials was change to an
instance variable however one reference was missed.  This commit fixes this
omission.
2017-03-08 16:11:07 -08:00
Rob Braden
03ad7bfa46 Merge pull request #198 from mattkirby/helper_no_global_vars
Update usage of global variablesin vsphere_helper
2017-03-08 15:22:56 -08:00
kirby@puppetlabs.com
80c01eb29d Update usage of global variablesin vsphere_helper
This commit updates usage of global variables in vsphere_helper to be instance variables. They do not need to be global variables as brought up in issue #194. Without this change we are setting global variables when they are not needed.
2017-03-08 15:14:34 -08:00
Rob Braden
04124a0e7a Merge pull request #191 from glennsarti/maint-rubocop
(maint) Fix rubocop offenses
2017-03-08 15:09:12 -08:00
Glenn Sarti
c14403682a (maint) Fix rubocop offenses
This commit updates VM Pooler to fix any existing rubocop offenses and also
fixes any offenses in the lib/vmpooler.rb file.  This commit also regenerates
the Todo file.
2017-03-07 20:17:32 -08:00
Rob Braden
e4cd64e47e Merge pull request #197 from mattkirby/double_connect_open
Remove duplicate of metrics.connect.open
2017-03-07 16:14:22 -08:00
kirby@puppetlabs.com
9eb6788148 Remove duplicate of metrics.connect.open
This commit removes a duplicate increment of the metrics.connect.open count. Without this change two connections will be reported when one is made.
2017-03-06 09:15:54 -08:00
Morgan Rhodes
850919f5db Merge pull request #189 from glennsarti/ticket/maint/rename-moves-and-clonevm
(POOLER-70) Refactor clone_vm to take pool configuration object
2017-03-02 11:39:29 -08:00
Morgan Rhodes
cc79bced17 Merge pull request #188 from glennsarti/ticket/master/gh-185
(GH-185) Remove unnecessary checks in check_ready_vm
2017-03-02 11:34:35 -08:00
Glenn Sarti
ac7d7009d2 (POOLER-70) Refactor clone_vm to take pool configuration object
Previously, the clone_vm method took various VSphere specific parameters e.g.
template folder.  However in order make VMPooler less VSphere specific this
method should just take the pool configuration and then it can determine the
appropriate settings itself.  This commit also moves the threading to a clone_vm
while the actual method which does the work is now _clone_vm as per all other
multithread worker methods in pool_manager.  This commit also updates the spec
tests appropriately.
2017-03-01 21:53:42 -08:00
Glenn Sarti
f433056734 (GH-185) Remove unnecessary checks in check_ready_vm
Previously in check_ready_vm, if the VM is powered off, the VM is moved in
redis however the function doesn't return there, and instead then checks if the
hostname is the same, and then if TCP socket 22 is open. This is unnecessary as
we already know the VM is turned off so of course the hostname is wrong and TCP
22 is unavailable. The same applies for the VM hostname.

This commit instead returns after it is found a VM is no longer ready.  This
commit also amends the spec tests for the correct behaviour.
2017-03-01 20:28:36 -08:00
Rob Braden
0754f86d8c Merge pull request #182 from glennsarti/ticket/master/POOLER-73-add-unit-tests
(POOLER-73) Update unit tests prior to refactoring
2017-03-01 17:54:38 -08:00
Rob Braden
dbd16ebc8c Merge pull request #187 from glennsarti/fix-rakefile-for-ruby
(maint) Only load rubocop rake tasks if gem is available
2017-02-28 15:12:46 -08:00
Glenn Sarti
f486129eab (maint) Only load rubocop rake tasks if gem is available
Previously in commit 145ecb443f Rakefile was modified to require the Rubocop
gem however, this gem is not available on jruby systems and would throw errors.
This commit modifies the Rakefile to first detect if the Gem is available and
optionally load the rubocop rake tasks.
2017-02-22 15:23:45 -08:00
Ryan McKern
145ecb443f Merge pull request #183 from glennsarti/add-rubocop
(maint) Add rubocop and allow failures in Travis CI
2017-02-21 16:10:17 -08:00
Glenn Sarti
e783e93784 (POOLER-73) Modify spec tests for _migrate_vm
Modify spec tests for _migrate_vm
2017-02-17 15:51:05 -08:00
Glenn Sarti
c69d61107f (POOLER-73) Modify spec tests for _revert_vm_snapshot
Modify spec tests for _revert_vm_snapshot
2017-02-17 15:51:05 -08:00
Glenn Sarti
b63822fa9f (POOLER-73) Modify spec tests for _create_vm_snapshot
Modify spec tests for _create_vm_snapshot
2017-02-17 15:51:05 -08:00
Glenn Sarti
0a6dffbd05 (POOLER-73) Add spec tests for _create_vm_disk
Add spec tests for _create_vm_disk
2017-02-17 15:51:05 -08:00
Glenn Sarti
3083186241 (POOLER-73) Add spec tests for _check_disk_queue
Add spec tests for _check_disk_queue
2017-02-17 15:51:05 -08:00
Glenn Sarti
25ad5d58f7 (POOLER-73) Add spec tests for _check_snapshot_queue
Add spec tests for _check_snapshot_queue
2017-02-17 15:51:05 -08:00
Glenn Sarti
6f127d32bc (POOLER-73) Add spec tests for check_snapshot_queue
Add spec tests for check_snapshot_queue

Previously the check_snapshot_queue method would execute the loop indefinitely
as it did not have a terminating condition.  This made it impossible to test.
This commit modifies the check_snapshot_queue method so that it can take a
maxloop and delay parameter so that it can be tested.
2017-02-17 15:51:05 -08:00
Glenn Sarti
4dd0c96a78 (POOLER-73) Add spec tests for check_disk_queue
Add spec tests for check_disk_queue

Previously the check_disk_queue method would execute the loop indefinitely as it
did not have a terminating condition.  This made it impossible to test.  This
commit modifies the check_disk_queue method so that it can take a maxloop and
delay parameter so that it can be tested.
2017-02-17 15:51:04 -08:00
Glenn Sarti
47d597f68a (POOLER-73) Add spec tests for migrate_vm_and_record_timing
Add spec tests for migrate_vm_and_record_timing
2017-02-17 15:51:04 -08:00
Glenn Sarti
fb6be8e079 (POOLER-73) Add spec tests for remove_vmpooler_migration_vm
Add spec tests for remove_vmpooler_migration_vm
2017-02-17 15:51:04 -08:00
Glenn Sarti
a4c55d5bf4 (POOLER-73) Add spec tests for migration_limit
Add spec tests for migration_limit
2017-02-17 15:51:04 -08:00
Glenn Sarti
925071be79 (POOLER-73) Add spec tests for migrate_vm
Add spect tests for migrate_vm
2017-02-17 15:51:04 -08:00
Glenn Sarti
713e202d68 (POOLER-73) Add spec tests for revert_vm_snapshot
Add spec tests for revert_vm_snapshot
2017-02-17 15:51:04 -08:00
Glenn Sarti
e6be5bfb75 (POOLER-73) Add spec tests for create_vm_snapshot
Add spec tests for create_vm_snapshot
2017-02-17 15:51:04 -08:00
Glenn Sarti
6f79c438c7 (POOLER-73) Add spec tests for create_vm_disk
Add spec tests for create_vm_disk
2017-02-17 15:51:04 -08:00
Glenn Sarti
943d3025d1 (POOLER-73) Remove #_stats_running_ready tests
This commit removes the #_stats_running_ready tests as they are covered in the
_check_pool tests.
2017-02-17 15:51:04 -08:00
Glenn Sarti
15d4dfa64a (POOLER-73) Add spec tests for _check_pool
Add spec tests for _check_pool
2017-02-17 15:51:04 -08:00
Glenn Sarti
64d2d95ab3 (POOLER-73) Remove #move_running_to_completed tests
The tests for #move_running_to_completed are already tested in the
2017-02-17 15:51:03 -08:00
Glenn Sarti
daad5c7086 (POOLER-73) Add spec tests for check_pool
Add spec tests for check_pool

Previously the check_pool method would execute the loop indefinitely as it did not
have a terminating condition.  This made it impossible to test.  This commit
modifies the check_pool method so that it can take a maxloop and delay parameter
so that it can be tested.
2017-02-17 15:51:03 -08:00
Glenn Sarti
5e46ace584 (POOLER-73) Add spec tests for execute!
Add spec tests for execute!

Previously the execute! method would execute the loop indefinitely as it did not
have a terminating condition.  This made it impossible to test.  This commit
modifies the execute! method so that it can take a maxloop and delay parameter
so that it can be tested.
2017-02-17 15:51:03 -08:00
Glenn Sarti
e342cfe56a (POOLER-73) Add spec tests for get_vm_host_info
Add spec tests for get_vm_host_info
2017-02-17 15:51:03 -08:00
Glenn Sarti
14c091383c (POOLER-73) Add spec tests for destroy_vm
Add spec tests for destroy_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
434ab546a2 (POOLER-73) Add spec tests for clone_vm
Add spec tests for clone_vm
2017-02-17 15:51:03 -08:00
Glenn Sarti
9d8b792c4a (POOLER-73) Add spec tests for move_vm_queue
Add spec tests for move_vm_queue
2017-02-17 15:51:03 -08:00
Glenn Sarti
cb4e1400aa (POOLER-73) Modify spec tests for _check_running_vm
Modify spec tests for _check_running_vm
2017-02-17 15:51:03 -08:00