Consistently use '_' for created_by metadata on images
implement sql migration support for QonoS

- initialize a new migration repository, 'migrate_repo'
- add version scripts to create tables as declared in models.py
- introduce CLI, 'qonos-manage' to run migration commands like,
  version_control, db_version, db_sync, downgrade & upgrade
- make 'qonos-api' db initialization to add the database to the
  migration repository for version control
- implement tests for testing the migration & changeset scripts.
- add 'sqlalchemy-migrate' dependancy to the pip-requires
- introduce MANIFEST.in for including migration config files as part
of the distribution package.
Merge pull request #273 from venkateshsampath/impl_sql_migration_support

implement sql migration support for QonoS
Uses unittest2 module

skipTest functionality provided in py27 and py3 can be used in py26
using this unittest2 module.
Merge pull request #275 from komawar/use-unittest2

Uses unittest2 module
Merge pull request #274 from ameade/created-by-mismatch

Consistently use '_' for created_by metadata on images
Fix duplicate scheduled images

This patch fixes the issue of the same job sometimes being picked up by
two workers when polling for jobs concurrently.

- In order to avoid the concurrency issue, the sqlalchemy's optimistic
  locking feature is used.
more info:
http://docs.sqlalchemy.org/en/rel_0_7/orm/mapper_config.html?highlight=uuid#sqlalchemy.orm.mapper
- Based on optimistic locking feature, a new column 'version_id' is
  introduced in 'jobs' table that will allow versioning of records when
in use.
- Because of versioning of job records when accessed, if two workers try
  to pick up/update the same job, a StaleDataError will be thrown and
hence prevent the duplication of scheduled images.

related to rm1348
Merge pull request #277 from venkateshsampath/duplicate_scheduled_images_fix

Fix duplicate scheduled images
Adds suitable indexes

Adds appropriate indexes to jobs and schedules to improve performance.
related to #RM1854
https://redmine.ohthree.com/issues/1854
Send latest payload info for job end notification

Send notification on change in job status
Fixes #RM196 and #RM3043
The payload sent had old job information.
It should be updated when a job is updated.
We need to track the status of jobs.
This patch takes care of sending a notification
whenever there is a update on job and an actual change in
status.
Also ensure that the latest job is sent in the payload
Fixed some pep8 errors.
Merge pull request #276 from amalaba/add_index

Adds suitable indexes
Merge pull request #272 from sridevikoushik31/payload

Send latest payload info for job end notification
Ensure all tables are created with utf8 character set

COMMON_TABLE_ARGS is intended to be used on all tables, but the schedules and jobs table override __table_args__ and don't include COMMON_TABLE_ARGS. This leaves the character set to be the default for the database. If the default is not utf8, you will see a problem similar to this when creating schedules_metadata where the character sets of the foreign key constraints don't match:

2014-02-07 22:31:54 CRITICAL [qonos] (OperationalError) (1005, "Can't create table 'qonos.job_metadata' (errno: 150)") '\nCREATE TABLE job_metadata (\n\tcreated_at DATETIME NOT NULL, \n\tupdated_at DATETIME NOT NULL, \n\tid VARCHAR(36) NOT NULL, \n\tjob_id VARCHAR(36) NOT NULL, \n\t`key` VARCHAR(255) NOT NULL, \n\tvalue TEXT NOT NULL, \n\tPRIMARY KEY (id), \n\tUNIQUE (job_id, `key`), \n\tFOREIGN KEY(job_id) REFERENCES jobs (id)\n)ENGINE=InnoDB CHARSET=utf8\n\n' ()
Merge pull request #280 from jerdfelt/patch-1

Ensure all tables are created with utf8 character set