Commit graph

483 commits

Author SHA1 Message Date
Josh Cooper
0fd6fff934 Revert "Merge pull request #155 from shermdog/RE-7014-cinext"
This reverts commit cc03a86f6a, reversing
changes made to 5aaab7c5c2.
2016-07-08 11:48:48 -07:00
Heath Seals
cc03a86f6a Merge pull request #155 from shermdog/RE-7014-cinext
(RE-7014) add statsd support
2016-06-10 08:28:02 +02:00
Rick Sherman
b06de4bb8e (RE-7014) update statsd to use gauge for running/ready
Previously was using increment which was incorrect for that particular application.
2016-06-08 16:55:57 -05:00
Rick Sherman
c133bed945 (RE-7014) statsd nitpicks and additional rspec
Cleaned up some code review nitpicks and added pool_manager_spec for empty pool.
2016-06-08 16:55:52 -05:00
Rick Sherman
b983472088 (RE-7014) Add tracking of vm gets via statsd
Add the tracking of successful, failed, invalid, and empty pool vm gets.  It is possible we may want to tweak this, but have validated with spec tests and pcaps.

```
vmpooler-tmp-dev.ready.debian-7-x86_64:1|c
vmpooler-tmp-dev.running.debian-7-x86_64:1|c

vmpooler-tmp-dev.checkout.invalid:1|c
vmpooler-tmp-dev.checkout.success.debian-7-x86_64:1|c
vmpooler-tmp-dev.checkout.empty:1|c

vmpooler-tmp-dev.running.debian-7-x86_64:1|c

vmpooler-tmp-dev.clone.debian-7-x86_64:12.10|ms

vmpooler-tmp-dev.ready.debian-7-x86_64:1|c
```
2016-06-07 23:01:03 -05:00
Rick Sherman
8d75865a5c (RE-7014) Add support for statsd
They way we were using graphite was incorrect for the type of data we were sending it.  statsd is the appropriate mechanism for our needs.
statsd and graphite are mutually exclusive and configuring statsd will take precendence over Graphite.  Example of configuration in vmpooler.yaml.example
2016-06-02 16:24:03 -05:00
Rick Bradley
5aaab7c5c2 [QENG-3919] Make vmpooler checkouts be all or nothing (#153)
* (QENG-3919) spike for implementation of all-or-nothing checkout

* Fix two botched variable references

* Aggregate API helper methods

* Add specs for failed multi-vm allocation API endpoints

* (QENG-3919) Add tests for multiple vm requests

* (QENG-3919) Add (failing) specs for POST /vm/pool1+pool2 usages

This exposes the old (bad) behavior on this other code path. Will fix this up next.

* (QENG-3919) Bring query params version in line with JSON post version

Not clear to me why these had to be implemented so differently.

* (QENG-3919) extract common method from both methods of VM allocation

* (QENG-3919) Naming fix, cosmetic cleanups

I mean, I presume all these commits are going to get squashed away on merge anyway.

* (QENG-3919) Update API docs

We consider it a bug that the actual behavior was not this behavior, but the
documentation was also silent on this point.

* (QENG-3919) minor readability tweak in refactored method

* (QENG-3919) Clean up interim comments re: status codes

* (QENG-3919) Drop now-orphaned `checkout_vm` method

We kept this up-to-date while we were upgrading and refactoring, but, turns out,
this method is no longer called anywhere.  💀 🔥

* (QENG-3919) Return 503 status on failed allocation

Making sure we go back to the original functionality, which was:

 - status 200 when vms successfully allocated
 - status 404 when a pool name is unknown
 - status 404 when no pool name is specified
 - status 503 when vm allocation failed

* (QENG-3919) add net-ldap to Gemfile

Maybe we shouldn't foil-ball gems onto servers.

* (QENG-3919) Turns out, spush isn't a redis command

And hence we see once again the weakness of mockist tests.

* (QENG-3919) Pin the net-ldap gem to 0.11 for the jrubies, etc.

* (QENG-3919) Correct an old spelling error in spec descriptions

* (QENG-3919) Further tweak net-ldap version

* (QENG-3919) return_single_vm -> return_vm_to_ready_state

cc @shermdog
2016-05-27 12:49:57 -05:00
Colin
b59a1f8886 Merge pull request #148 from sschneid/master
Update license copyright
2016-01-14 16:07:49 -08:00
Scott Schneider
d11cd2964d Update license copyright 2016-01-14 15:48:24 -08:00
Colin
d4f3eb3c5f Merge pull request #147 from sschneid/add_disk
Allow new disks to be added to running VMs via vmpooler API
2016-01-14 14:38:24 -08:00
Scott Schneider
48a1a8d621 Add new disks via API
Add an additional disk to a running VM via the vmpooler API.

````
$ curl -X POST -H X-AUTH-TOKEN:a9znth9dn01t416hrguu56ze37t790bl --url vmpooler.company.com/api/v1/vm/fq6qlpjlsskycq6/disk/8
````
````json
{
  "ok": true,
  "fq6qlpjlsskycq6": {
    "disk": "+8mb"
  }
}
````

Provisioning and attaching disks can take a moment, but once the task completes it will be reflected in a `GET /vm/<hostname>` query:

````
$ curl --url vmpooler.company.com/api/v1/vm/fq6qlpjlsskycq6
````
````json
{
  "ok": true,
  "fq6qlpjlsskycq6": {
    "template": "debian-7-x86_64",
    "lifetime": 2,
    "running": 0.08,
    "state": "running",
    "disk": [
      "+8mb"
    ],
    "domain": "delivery.puppetlabs.net"
  }
}
2016-01-14 10:46:57 -08:00
Scott Schneider
9e8a7d034b Merge pull request #149 from frozenfoxx/master
Added prefix parameter to the vmpooler configuration
2016-01-14 10:42:33 -08:00
Scott Schneider
7d0f7254ae Disk-adding functionality for vsphere_helper lib
This commit adds the following functions:

- `add_disk`: the wrapper function to add a new disk to a VM

Usage is:

````
add_disk(vmname, disksize, datastore)
````

`vmname` is the name of the VM to add the disk to, `disksize` is the
disk size in MB, and `datastore` is the datastore on which to provision
the new disk.

`add_disk` required the addition of the following helper functions:

- `find_device`: locate a device object in vSphere
- `find_disk_controller`: find the disk controller used by a VM
- `find_disk_devices`: find the disk devices used by a VM
- `find_disk_unit_number`: find a free SCSI ID to assign to a new disk
- `find_vmdks`: find names of VMDK disks attached to a VM
2016-01-14 10:35:22 -08:00
FOXX
38a184c6f5 Made adjustments from colinPL 2016-01-14 12:27:46 -06:00
FOXX
10e507c262 Added prefix parameter to the vmpooler configuration 2016-01-14 11:42:12 -06:00
Colin
ad4e760f56 Merge pull request #109 from sschneid/dashboard2
An updated dashboard
2016-01-13 15:15:56 -08:00
Scott Schneider
5f787a3ca7 dashboard2 2016-01-13 12:01:05 -08:00
Scott Schneider
b79c3bfb75 Merge pull request #145 from frozenfoxx/patch-1
Updated YAML config variables in create_template_deltas.rb
2016-01-06 10:05:59 -08:00
FOXX
61bbb798ca Updated YAML config variables
The symbol notation for the YAML variables "server," "username," and, "password," were not working for me.  When changing them to strings the script seems to work.
2016-01-05 13:59:05 -06:00
Colin
b60ceb12bf Merge pull request #143 from cowofevil/maint/master/QA-2036/update_readme_for_client
(QA-2036) Update README for Client Utility
2015-12-28 10:52:31 -08:00
Ryan Gard
1a78b1ae0d (QA-2036) Update README for Client Utility
Add a new section to the README to reference the CLI utility for accessing
vmpooler services.
[skip ci]
2015-12-18 15:33:25 -08:00
Scott Schneider
1a6cd99ed2 Merge pull request #139 from heathseals/extraconfig
add guestinfo.hostname to VirtualMachineConfigSpecs
2015-11-13 10:13:55 -08:00
Scott Schneider
20fa7d20be Merge pull request #138 from sschneid/qeng_2807
(QENG-2807) Allow pool 'alias' names
2015-11-13 09:24:48 -08:00
Heath Seals
6b9bcc4307 add guestinfo.hostname to VirtualMachineConfigSpecs
This commit adds a custom guestinfo keyword and hostname variable
that allows the VMware Tools to query the hostname.
2015-11-10 16:50:27 -08:00
Scott Schneider
1fcda86124 Spec tests for pool aliases, /vm/:template
This PR adds spec testing for pool 'alias' functionality introduced in
17b24d6, as well as the following previously non-existant tests:

- new tests for handling requests for a VM from a nonexistant pool
- new tests for the `POST /vm/:template` endpoint
2015-11-05 11:53:38 -08:00
Scott Schneider
17b24d69ad Allow pool 'alias' names
The following pool configuration would allow a pool to be aliased in POST
requests as 'centos-6-x86_64', 'centos-6-amd64', or 'centos-6-64':

````yaml
- name: 'centos-6-x86_64'
  alias: [ 'centos-6-amd64', 'centos-6-64' ]
  template: 'templates/centos-6-x86_64'
  folder: 'vmpooler/centos-6-x86_64'
  datastore: 'instance1'
  size: 5
````

The 'alias' configuration can be either a string or an array.

Note that even when requesting an alias, the pool's 'name' is returned in
the JSON response:

````
$ curl -d '{"centos-6-64":"1"}' --url vmpooler/api/v1/vm
````
````json
{
  "ok": true,
  "centos-6-x86_64": {
    "hostname": "cuna2qeahwlzji7"
  },
  "domain": "company.com"
}
````
2015-11-05 11:51:53 -08:00
Michael Stahnke
36f83fef82 Merge pull request #137 from sschneid/token_vm_list
(QENG-2995) Display associated VMs in GET /token/:token endpoint
2015-11-05 10:36:15 -08:00
Scott Schneider
d74c9ff512 Don't require username/password authentication for GET /token/:token route 2015-11-04 13:19:15 -08:00
Scott Schneider
e0356968df (QENG-2995) Display associated VMs in GET /token/:token endpoint 2015-11-04 12:35:35 -08:00
Scott Schneider
12da1e07d2 Merge pull request #136 from briancain/master
Update API docs to include "domain" key for get vm requests
2015-10-20 14:58:34 -05:00
Brian Cain
e1168e1145 Update API docs to include "domain" key for get vm requests 2015-10-16 15:32:07 -07:00
Scott Schneider
d9724b698c Merge pull request #133 from colinPL/maint_remove_ping
(MAINT) Remove Ping Check on Running VMs
2015-10-02 13:08:05 -07:00
Colin
7b9b178861 (MAINT) Remove Ping Check on Running VMs
Prior to this commit, a running VM could fail a ping check and be
destroyed. This causes issues when network hiccups occur or the machine
is performing a reboot.

A VM that is in a ready state will now be destroyed when handed back or
it hits the lifetime TTL.
2015-10-02 13:03:48 -07:00
Scott Schneider
c5d0850dd1 Merge pull request #131 from puppetlabs/maint_wait_pending
(maint) Move VM Only When SSH Check Succeeds
2015-09-17 15:39:39 -07:00
Colin
b8bdfe1301 (maint) Move VM Only When SSH Check Succeeds
An SSH check was added before moving a VM from pending to ready.
However, the result of that check did not matter and move_pending would
still be called. This moves the move_pending call to within the begin
block that holds the SSH check. If the check fails, then only
fail_pending will be called.
2015-09-17 12:54:29 -07:00
Colin
6395d0227e Merge pull request #130 from sschneid/check_ssh_before_marking_ready
(QENG-2952) Check that SSH is available
2015-09-17 11:58:44 -07:00
Scott Schneider
d1c8bcdbcc RSpec mocking for TCPSocket.new 2015-09-17 11:31:31 -07:00
Scott Schneider
5b6985c3a7 (QENG-2952) Check that SSH is available
SSH should be available before a VM is moved from the 'pending' queue to
'ready'.

`check_ssh` should probably be a function in the tradition of DRY; I'm
going to hopefully follow up this PR with a `Vmpooler::Utility` library.
2015-09-17 11:12:51 -07:00
Colin
0c1e89f047 Merge pull request #127 from sschneid/duplicate_ok
(maint) Remove duplicate (nested) "ok" responses
2015-09-04 11:36:57 -07:00
Michael Stahnke
3fdf1685ba Merge pull request #128 from sschneid/license_update
(maint) Update license copyright
2015-08-22 14:13:30 -07:00
Scott Schneider
40b13e2b22 Update license copyright 2015-08-21 18:07:07 -07:00
Scott Schneider
906ae89987 Remove duplicate (nested) "ok" responses
As we approach an "official" v1.0.0 of the API I'd like to remove some old
nested "ok" responses.  These were left in as the Beaker vmpooler
hypervisor used them, but I long-ago patched that code and I think it's
time to deprecate these.
2015-08-21 13:58:07 -07:00
Colin
f7ad3bb7e8 Merge pull request #126 from sschneid/missing_docs
(maint) Documentation updates
2015-08-21 13:11:06 -07:00
Scott Schneider
fd6a707b15 /api/v1 2015-08-20 22:41:19 -07:00
Scott Schneider
5e30932900 Snapshot route documentation 2015-08-20 22:39:48 -07:00
Scott Schneider
825ade9e12 'clone_target' is overridable pool-level
You know, like for a cluster of Mac Minis, maybe.
2015-08-20 22:25:42 -07:00
Justin Stoller
9ae19e0d4d Merge pull request #125 from sschneid/token_last
Track token use times
2015-08-20 20:31:33 -07:00
Scott Schneider
89ce70dba9 Track token use times
* rename the Redis token 'timestamp' var to 'created'
* update the Redis token 'last' var when token is successfully validataed
* expose the Redis token 'last' var in GET /token route
2015-08-20 19:54:59 -07:00
Justin Stoller
ce158d9fec Merge pull request #123 from sschneid/user_token_list
User token list
2015-08-20 19:15:20 -07:00
Scott Schneider
e4f2777889 Spec tests for GET /token 2015-08-20 18:50:55 -07:00