alembic with initial migration and tests

All sqlalchemy migrations and code associated
with them was removed including tests

Added all necessery alembic code to expose alembic specific features:
like revision and stamp

Added initial migration for alembic, that is fully in sync with models
including: uniques, indexes and columns params

Refactored test_versions to use alembic as migration api

Refactored BaseTestCase and Database fixture to use alembic as migration api

Change-Id: I8a91704d21ccea1b8135b9d724df5856ac21108c
Allow to tear-down a node waiting to be deployed

Introducing a new state, WAITDEPLOYING, those nodes which have failed
to POST and trigger the vendor_passthru._continue_deploy() can be
tear-down.

Closes-Bug: #1270986
Change-Id: Ib98f1ba6a29de46df9ce54941d0558df4f241f40
Move eventlent monkeypatch out of cmd/

Completing a #TODO that I left for myself months ago,
now that we are using PBR for our build system,
move the eventlent monkey patching out of ironic/cmd/__init__
and into ironic/__init__

Change-Id: I1fd352919de0a2afe7058ab84c208781ce095dab
Make ironic-api not single threaded

The ironic-api service is an instance of wsgiref
simple_server.WSGIServer.  This derives from SocketServer.TCPServer,
which requires that SocketServer.ThreadingMixIn be mixed in for it to
become thread'able, however this was not being done when starting the
WSGIServer.

This patch creates a ThreadedSimpleServer class, which is just a mix
of ThreadingMixIn and WSGIServer, so that the ironic-api process
does not block on network IO.

Change-Id: I9d686765edb4975519840a51d3beeb2be797a4fa
Related-bug: #1279206
Use StringType from WSME

After WSME 0.6 released we can use StringType class from wsme.types
and remove it from Ironic code.

Change-Id: I00378bb126a1d786330b7cad3ac671d992a3109d
Removes use of timeutils.set_time_override

The set_time_override function in timeutils was written as a
helper function to mock utcnow for unittests before 'mock' was
generally used. Now that we have mock and fixture, we no longer
need to use it.

Change-Id: Ibcf6d4abee4a52bc459fc322e6a5268d39d70450
Partial-Bug: #1266962
Add common.service config options to sample

openstack/common/config/generator.py looks for a variable that is a list
of config options. The code in common.service was written with the list
passed as an argument to cfg.CONF.register_opts(), instead of being
assigned to a variable first, so the generator didn't detect it.

In common.service, the list of config options is now assigned to a variable.
The ironic.conf.sample file generated by tools/config/generate_sample.sh
now includes the two config options: periodic_interval and host.

Change-Id: I2f42e7f407ffc157d225652045c1bf53f65405b3
Closes-Bug: #1280064
Fix task_manager acquire post landing for c4f2f26ed

In original implementation we used context lib with try/finally
to make sure release_resources will be called even if there was an
exception inside acquire_resources. With c4f2f26ed we broke that
functionality, so this patch intended to fix this.

Closes-Bug: #1279992
Change-Id: I04abc67aedc226bc126b1d93901c71bcd8a5bf15
Add wsme custom BooleanType type

This type can be used in the wsexpose decorator to validate boolean
types when the request comes in.

Change-Id: I9492e4c4c8c33335ff79129c58f05b15172b0aee
Use the custom wsme BooleanType on the nodes api

Instead of using a wtypes.text on the boolean types in the api and then
having to convert it, this patch uses the custom wsme BooleanType to
make the validation for it.

Change-Id: I0165c31034185beb80e50d499cb0dc67b15e45dd
Merge "Make ironic-api not single threaded"
Merge "Move eventlent monkeypatch out of cmd/"
Don't raise MySQL 2013 'Lost connection' errors

Although this code error is part of the `ping_listener` tests, it was
missing from the list of known - and ignored - connection errors.

The code error 2013 refers to a connection lost during a query, see:
https://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html#error_cr_server_lost

Without this error code, the session won't try to reconnect to mysql,
which makes `max_retries` useless.

Closes-bug: #1276510
Change-Id: I27cad999b30a480ae23250150bfcba2668acabd7
Correct PXEPrivateMethodsTestCase.setUp

Unit tests within the PXEPrivateMethodsTestCase test class have been
sporadically failing on py26 test nodes since f14dacb7. That commit
introduced tests that interacted with the DB without inheriting from
DbTestCase, and loaded a driver via stevedore without mocking the
extension manager loading.

This patch corrects the above ommissions.

Change-Id: I2f930db7d3bb8abe120ce24a604f800c2e861fca
Closes-bug: #1279992
Merge "alembic with initial migration and tests"
Add JSONEncodedType with enforced type checking

Add abstract base class for JSONEncoded properties which: 1. Does type
checking to make sure we're serializing what we really expect
2. Ensures that default value of the field matches default value of
that type, so we have consistent interface. This patch creates two child
classes JSONEncodedDict and JSONEncodedList and updates SA models
correspondingly.

Change-Id: I528ac64e998e9a874feb16709d7617feb4b09c8a
Closes-Bug: #1270146
Merge "Use StringType from WSME"
Use six.StringIO/BytesIO instead of StringIO.StringIO

to keep Python 3.x compatibility, use six.StringIO/BytesIO to
replace StringIO.StringIO

StringIO works for unicode
BytesIO works for bytes

Change-Id: I0d1f8a55c3bc41379077b46feb81931779b7ad45
Partial-Bug: #1280100
Move ipmitool _set_boot_device to VendorPassthru

_set_boot_device must be exposed via vendor_passthru, allowing
operators to manually change it, and force to boot from net when
performing a pxe deploy.
Until now, it was just a private method of the power driver.

Partial-Bug: #1264596
Change-Id: I174f0a058bfe6276b7a42291661f3fd00de9a7ca
Sync Oslo service module to Ironic

New Oslo service code does correct stop Ironic conductor service from
screen session on devstack (screen -S stack -p ir-cond -X kill),
otherwise multiple conductors started on devstack after few
unstack/rejoin-stack cycles.

Change-Id: Ia8b4523e1288ca0817b94f85070f78237908a410