Catch exception when image cache pruning

If a cached image file does not exist, os.stat will throw an exception
and the glance-cache-pruner can fail to run when it encounters
the non-existent file.

Adds a catch for the possible exception and sets file size to 0 so
the glance-cache-pruner can successfully run and prune the cache.

Change-Id: I55bee82c4a7aa0393d36c603c91adb8b44a7c7a3
Fixes: bug #1286240
Include Location header in POST /tasks response

In addition to returning a 201, a successful POST to /tasks
should include a Location header with the direct path to the
newly created resource.

Closes-bug: #1287760

Change-Id: I11001e1d6bb5168f0ee80c3d81574e59ddd47147
Fix glance db migration failed on 031

In fact, the first where expression has filtered the duplicated locations,
and the second filters the locations which have more than 1 rows, so the
second result set is included in the first.
In DB2, if the boolean of where expression is true, it will throw error.
So remove the second where expression to fix glance db migration failed on 031.

Fixes bug #1287087

Change-Id: Id485b6d20696e989d10f3759011387137543918a
Merge "Include Location header in POST /tasks response"
Merge "Catch exception when image cache pruning"
Merge "Fix glance db migration failed on 031"