2226 Commits

Author SHA1 Message Date
James E. Blair
7a1fe1891f Add a nodepool command
Moves the daemon command to nodepoold.

Refactor config handling a bit in NodePool to make the config
objects just contain information by default (though things
such as database handles and managers may get added to them
later as needed).

Start with the list and image-list commands.

Change-Id: If2ba7bca7ab4ef922787176af87ad5de31ae4b3e
2013-09-03 09:27:04 -07:00
James E. Blair
b1b8a569ef Add image logging
Log stdout/stderr from the image build process.  Use the provider
and image name in the log selector so that admins can route
appropriately (or at least grep).

Change-Id: I7bc74ebfca3184340b51b083695b3441f0924e83
2013-08-29 16:20:40 -07:00
Monty Taylor
1e190f5d57 Change use of error numbers to errno
The errno constants are more readble in the code.

Change-Id: I6cb4b61f4cf59f50969a7fc27cad35d9c90755f8
2013-08-28 14:56:06 -07:00
James E. Blair
5ebc2faae8 Fix image delete logic
The logic around when to delete an image was just completely wrong.

Also, rackspace sometimes returns a deleted image when we request
it, while hp returns a 404.  Deal with both of those situations.

Change-Id: I4b6d620a750bd39a1d3b89e6eb51baf37694f8a7
2013-08-25 08:53:42 -07:00
James E. Blair
6b508398f9 Fix typo in node check method
Copy/paste error.

Change-Id: Ie3824cc6f40aa4fdc3cd4a8575aad935dfeb884c
2013-08-24 15:42:09 -07:00
James E. Blair
8436625994 Fix typo in deleteImage
remote_image is a dict, not an object now.

Change-Id: I272b5c9742317af5424a7f5b44e02ec7f27cf213
2013-08-24 14:42:02 -07:00
James E. Blair
861a5dbc91 Add option to test jenkins node before use
Add a new node state, TEST, and if a test job name is supplied
put the node in the TEST state, and run that job with the node
name as a parameter.  If the job succeeds, move it into READY
and relabel it with the appropriate label (from the image name).

If it fails, immediately delete the node.

If it never runs, it will eventually be cleaned up by the
periodic cleanup task.

Change-Id: I5ba1ea8cdc832b13a760edaee841487afe7d7ce4
2013-08-22 16:17:36 -07:00
James E. Blair
cffb319ee9 Make jenkins username and private key path configurable
This mostly assists local dev, but is a good idea anyway.

Move the zmq port in the test script so it does not conflict
with the default port in the jenkins zmq plugin (more local
dev assist).

Change-Id: I68f7fc31fe7e2a819568a2f40626641dee240387
2013-08-22 16:16:28 -07:00
James E. Blair
b045d00509 Fix error with stats for de-configured resources
If a target, provider, or image did not exist in the config but
was still in the db, the stats function would encounter a KeyError.
This makes sure we can still report stats for lingering resources.

Change-Id: Iade002917dbcb2931bb4f9ff009516d24c47e743
2013-08-22 13:15:49 -07:00
James E. Blair
a684768fa4 Move setup scripts destination
Move them to /opt/nodepool-scripts so they are in a nice
world-readable location so that they can be run as any user.

Change-Id: I007e341fbe17067c164d3712fcfb7e744bdd80e9
2013-08-22 10:44:43 -07:00
James E. Blair
5935e3c747 Reduce timeout when waiting for server deletion
From 1 hour to 10 minutes.  If it isn't deleted, it will get
deleted by the next pass of the cleanup process.

Change-Id: I6dd1693d14fd215117ddbed8440ff4abe02c374c
2013-08-22 10:44:09 -07:00
James E. Blair
648816feee Change credentials-id parameter in config file
To use a dash to be consistent.

Change-Id: Ifee3cfe9ad18989d09ef896408e7bb3f78e54f2c
2013-08-22 10:44:03 -07:00
James E. Blair
4208746997 Add an ssh check periodic task
If we can't ssh into a node, delete it.

Change-Id: Ie53187ff5c37941709a2cb708b0bf76116138093
2013-08-22 10:44:00 -07:00
James E. Blair
0ec2246514 Add JenkinsManager
Same idea as a ProviderManager: serialize changes to each jenkins
server (with a rate limit).

Change-Id: I631d50dcfd13c29d2802c192d6e1ac7889256a90
2013-08-22 10:43:33 -07:00
James E. Blair
8dc6c870f2 Add ProviderManager
This is used to serialize all access to an individual provider
(nova client).  One ProviderManager is created for every provider
defined in the configuration.  Any actions that require interaction
with nova submit a task to the manager which processes them serially
with an appropriate delay to ensure that rate limits are not hit.

This solves not only rate-limit problems, but also ends multi-threaded
access to a single novaclient Client object.

Change-Id: I0cdaa747dac08cdbe4719cb6c9c220678b7a0320
2013-08-20 15:34:14 -07:00
James E. Blair
d3386fb24a Delay 1 min before deleting node
This should allow the background Jenkins console scp to complete.

Change-Id: I15a91a93c48dc4f22602837bed9df2ac93f24069
2013-08-18 12:39:59 -07:00
James E. Blair
70e68a4fe2 Cache novaclient objects
Novaclient instances (via their internal requests.Session object)
do not correctly clean up after themselves.  This visibly manifests
in the file descriptors for sockets not being closed.

A simple solution to this problem that also gains some efficiency
is to cache the novaclient objects for each provider.  Based on
limited examination and research, I believe they are thread-safe.
The underlying requests library certainly is expected to be.

Change-Id: I541a0783fabef368449ef6dc8c3cf766d3560bfa
2013-08-18 09:09:52 -07:00
James E. Blair
fd53ecc88d Tune SQLAlchemy pool parameters
We can burst and create a lot of threads, each of which will checkout
a SQLAlchemy connection from the pool.  This accomodates that.

We have a natural limit on the number of db connections -- we will
never use more than the total number of servers managed.  So in that
case, just don't set an overflow limit for the db connection pool.
This means that it will stabilize on 5 open connections and burst
to as many as needed.

Also, ensure that the connection is returned to the pool in the
context manager exit method, as well as setting it to None so that
the session can not be re-used again (this is an easy way to make
sure that it can't be used except as a context manager).

Change-Id: Ie4628326b6b84fb0979e4eceed546404c4e30637
2013-08-17 15:30:10 -07:00
James E. Blair
a5a78ef441 Use a sensible SQLAlchemy session model
The existing db session strategy was inherited from a bunch of
shell scripts that ran once in a single thread and exited.

The surprising thing is that even worked at all.  This change
replaces that "strategy" with one where each thread clearly
begins a new session as a context manager and passes that around
to functions that need the DB.  A thread-local session is used
for convenience and extra safety.

This also adds a fake provider that will produce fake images and
servers quickly without needing a real nova or jenkins.  This was
used to develop the database change.

Also some minor logging changes and very brief developer docs.

Change-Id: I45e6564cb061f81d79c47a31e17f5d85cd1d9306
2013-08-16 20:21:33 -07:00
James E. Blair
35d66f0d77 Make the target name required in the schema
Change-Id: Icccdc1cc545391fa17544f555bc0537540a53bd8
2013-08-15 17:52:25 -07:00
James E. Blair
a7144ff7d1 Require a target name when instantiating a node
This is effectively a required db field; without it, the watermark
calculation can be wrong until it's filled in, so make sure it's
there to start.

Also some minor logging changes.

Change-Id: Idc5a9cd40fe330f7a1aea4a5513267ee3c254f60
2013-08-15 17:49:44 -07:00
James E. Blair
33346b37ac Use MySQL
And some other minor changes gleaned from production testing.

Remove the scripts dir because it is no longer needed.

Change-Id: I7ffe3ed8d2a1be294637ac18bc3eaefede97d401
2013-08-15 17:49:41 -07:00
James E. Blair
c409795e57 Make the local script directory configurable
Change-Id: Ia446f2e25748725ce4b64a3a654b4e50da672944
2013-08-15 17:47:03 -07:00
James E. Blair
a641ac52a9 Handle paramiko and daemonization
Change-Id: I6e58cb24b6594dc5ee6c7ba34bf9bfed9d303480
2013-08-15 13:32:39 -07:00
James E. Blair
5866f10601 Initial commit
Much of this comes from devstack-gate.

Change-Id: I7af197743cdf9523318605b6e85d2cc747a356c7
2013-08-15 09:47:23 -07:00
OpenStack Project Creator
a3db12fae9 Added .gitreview 2013-08-13 17:10:06 +00:00