Add an image repo to encapsulate db api access

This patch adds glance.db.ImageRepo which provides a Repository-like
abstraction over image persistence. In the process of testing, a few
additional changes to the simple and sqlalchemy db apis were needed.

Partially implements bp:glance-domain-logic-layer

Change-Id: Ie35e427aa8fc7f3bece8d4d383afde4cc02b2096
Add note about urlencoding the sql_connection config opt

Fixes bug 1075676.

Change-Id: Ib4149277b6ec060350a3a01496e3b01c26c19181
Remove unused imports

Change-Id: Ie5c4e7258a857d73c852897c7eef99bd1d062182
Stop logging all registry client exceptions

Not all exceptions need to be logged as ERROR in the glance-api
log when - for instance, a user asking for an image that does not
exist doesn't mean an ERROR actually occurred. This logs the exception
name at INFO level. An ERROR won't be logged at all, even in
the case of a 500-level response from glance-registry. An operator
would be alerted with an ERROR log in the glance-registry log in that
case.

Fixes bug 1079211.

Change-Id: Ie2bba3105f8d9f3de97bc50132fb046baf710a90
Audit error logging

Reduce log level from error to info/debug in several cases
where users do something silly. The operator of Glance
does not need to be alerted with an ERROR log in these
cases.

Fixes bug 1079211.

Change-Id: I09d86c8727530cf58f22446493ef9c4789d5d6cb
Merge "Stop logging all registry client exceptions"
Merge "Audit error logging"
Merge "Remove unused imports"
Refactor where store drivers are initialized

The call to create_stores was happening in the v1 and v2 API
controllers. This moves that call and the verification that
the default_store exists into the necessary binaries.

Fixes bug 1039727.

Change-Id: I36542fd9b1d536d6266898766317abe110bb71a2
Allow for not running pep8.

Its not always wanted to run pep8 so we should have
a flag that can be used to disable it so that people
who do not want to run it can accomplish this.

Fixes: bug 1080907

Change-Id: I7f9dedbc7eca8421e0acf58e478c105f8b8de0c9
Merge "Add an image repo to encapsulate db api access"
Merge "Refactor where store drivers are initialized"
Add an image proxy to handle stored image data

When you delete an image, it should delete (or submit a delayed delete
for) the data in the store.

Part of implementing bp:glance-domain-logic-layer

Change-Id: I1ef4d6915a5fed02316b6945c99599511ea0392b
Make cooperative reader always support read()

glance.common.utils.CooperativeReader provides eventlet-friendly
cooperation on top of backends that support either read() or __iter__().
However, in the case of backends that only support __iter__(), such as
images returned by store.get(...), read() is not defined. This patch
adds read() in all cases.

Fixes bug 1057322.

Change-Id: I67d9b3e4d93fbefd7eeaf7cfc947ab635fe09534
Merge "Allow for not running pep8."
Merge "Make cooperative reader always support read()"
Merge "Add an image proxy to handle stored image data"
Fix typo uudiutils -> uuidutils

Change-Id: I5e259f02a0db09ccdc45b04fdeda2d6d428ab304
Add pep8 ignore options to run_tests.sh

Updates run_tests.sh so it uses the same pep8 ignore options
we do for tox. This fixes a slew of pep8 errors that will occur
with recent pep8 releases using Glance.

Change-Id: I0a9bb237f75eb307ee433cc6b1c5f78cd71dd02e
Wrap log messages with _()

Bug 1075088

There are a few log messages without _(), but a lot messages with _().
Wrap these log messages with _() in order to make the code consistent.

Change-Id: I8f3c66c23c7e42d7b4ede11c26d5f9c96c39be73