Consistently use '_' for created_by metadata on images
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