db2 does not allow None as a key for user_id in user collection

mongodb allows None value as a key for _id field, but db2 does not.
this patch will fix the problem when meters coming with user_id
being set to None.

fixes: bug #1234165
(cherry picked from commit 77a0603bebcb25fba94ddfb40e50baed46eb9384)

Change-Id: Icdb53e0835faf7d469a8af882a3dcd7e161a1d1d
Return 401 when action is not authorized

When a user is not authorized to access to something is the API,
this one return 401 instead of 400 now.

Fixes bug #1232045

(cherry picked from commit b2df5f9013f6d30097d5841027a759af0e9c8002)

Change-Id: I37ef87f79cd55e095132e0865cbaa324cd76323c
Ensure combination alarm evaluator can be loaded

Fixes bug 1237578

Previously combination alarms were always skipped as the evaluator
was missing from the loadable stevedore extensions.

Change-Id: I9d164fb2a89ee9931fc032d93ad4a26ba6887f0b
(cherry picked from commit 61af83ddd832e63deb4b72fa11c7b18df7ae4702)
Ensure combination alarms can be evaluated

Fixes bug 1237589

Previously the retrieval of state for the constituent alarms always
failed for combination alarms, due to an incorrect attribute of
ceilometerclient being used. As a result combination alarms could
never be successfully evaluated.

Now the correct pluralized attribute is used.

Change-Id: Id58a5d185854367e5a08011048774ab5aed93d4e
(cherry picked from commit f44e292e7a16d09db36d8b2f9223e3d54202f8d2)
Merge "Return 401 when action is not authorized" into milestone-proposed
Merge "Ensure combination alarm evaluator can be loaded" into milestone-proposed
Merge "Ensure combination alarms can be evaluated" into milestone-proposed
Change resource.resource_metadata to text type

The existing resource.resource_metadata column size is 5k chars,
which is not enough for some large JSON metadata payload,
so change to as Text column to make sure store all JSON string
without truncating.

Fixes bug #1220683

(cherry picked from commit 7f3e7cea0ec9d8eb7095c2790fe0ba327c2df242)

Change-Id: I898ff2706cbaccafec6060bbdb0bbf68a4209edd
Add support for keystoneclient 0.4.0

Keystoneclient auth_middleware changed the way it parses the datetime
returned from the cache, breaking the Ceilometer unit tests. This patch
fixes the fake cache system that's used in unit test, so it works with
all keystoneclient versions.

This also update the sample configuration files to include the new
options provided by keystoneclient 0.4.0.

Fixes-Bug: #1238529

Change-Id: Iecfd50d9e9801aeb919f2c09a728e4ea15245a5e
(cherry picked from commit e3cef871ac5a92d38d42fe09d9ac2dbe4404f679)
Avoid leaking admin-ness into threshold-oriented alarms

Fixes bug 1237567

Previously when an admin created a threshold-oriented alarm on
behalf of an non-admin identity, this had the effect of leaking
visibility onto statistics for resources that would not normally
be visible to the non-admin tenant.

Now we ensure that an additional implicit threshold rule query
constraint is added on the project ID of the non-admin indentity
that will ultimately own the alarm.

This is acheived by splitting the query validation from the
construction of the kwargs from the query. The addition of the
implicit query constraint to the threshold rule can then be
delayed to a later point in the dispatch path where the full
context of the alarm is known (so that we can check for the case
where the alarm is created by an admin on behalf of another tenant).

Change-Id: I1adae8c899112e7c3eb4e94f3f68262c84a98574
(cherry picked from commit 7ee6f6d29451be4f2c9d5146e4cfbc147f33ee04)
Merge "Avoid leaking admin-ness into threshold-oriented alarms" into milestone-proposed
Merge "Change resource.resource_metadata to text type" into milestone-proposed
Avoid leaking admin-ness into combination alarms

Previously when an admin created a combination alarm on
behalf of an non-admin identity, this had the effect of leaking
visibility onto alarms that would not normally
be visible to the non-admin tenant.

Now we validate all alarm ids with the project ID of the non-admin
identity that will ultimately own the alarm instead of the project ID
of the API caller.

Fixes bug #1237632

Change-Id: I5d1cf41c9182f09bc37b93deb14dda58f1d6dcd6
(cherry picked from commit a8e93ddc9e0d79c603573a2e0f26cef115579534)
Change alarm_history.detail to text type

The existing alarm_history.detail column size is 255 chars,
which is not enough for some large JSON payloads.

Change to Text column to make sure we store all detail.

Closes-Bug: #1236861
Signed-off-by: Stephen Gran <stephen.gran@guardian.co.uk>
(cherry picked from commit 57eb9e904aacae166d7265a914960415c57cd133)

Change-Id: I1460c2a5bbd5cb465a605bb80775853468148026
Merge "Change alarm_history.detail to text type" into milestone-proposed
Ensure we don't access the net when building docs

(Note, this has not been sent upstream)

Change-Id: I9d02fb4053a8106672aded1614a2850e21603eb2