Optimize db.instance_floating_address_get_all method

Optimize db.instance_floating_address_get_all
Was:
Get FixedIps with corresponding instance_uuid
For each FixedIp get associated FloatIp (N request)
Now:
Get only list of FixedIps ids
Get all corresponding FloatingIp with one query (select in)
Get only addresses from FloatingIps (because we are using only it)

Add temporary test for db.instance_floating_address_get_all to
ensure that it works as expected.

Change-Id: Id3c515de0ca35707bbfe46b991c2d7cf591e431b
Cleanup create flavor tests

In preparation for some refactoring and additional features to the create
flavor method, this patch cleanups the existing tests by:

* Moving flavor create tests out to their own class

* Adding more coverage around boundary conditions

* Making tests more orthogonal (not testing that `root_gb` was set correctly in
  multiple tests, for example)

Change-Id: I82acadc19d2713406c3be01a104ccd64377098ed
Cleanups for create-flavor

Instead of setting defaults values to None in the signature and then setting
the *real* default in the function body, it's more concise/readable to set the
value in the signature itself (when dealing with immutable types).

Along with this, the handling of `memory_mb` and `vcpus` was detangled so the
attributes were handled in one place and not across both the non-negative and
positive int checks.

Change-Id: I1c06768c2fd076adc8c0a647a492dabb67b7bf79
Fix response from snapshot create stub

A change from Oleg highlighted that the current snapshot create
stub is broken because it passes a full volume for the volume_id
paramter.

Fix the stub and the api_samples output, but also add unit test
checks which would have caught this.

Change-Id: Id006e3995c7696aa8f061a2b96123ea27e4b6d3f
Co-authored-by: Oleg Bondarev <obondarev@mirantis.com>
Refactored tests for db.key_pair_*() functions.

All tests for db.key_pair_*() functions are in KeyPairTestCase class now.

blueprint test-db-api

Change-Id: I92358bcda157c95290b31e3b7997e3432a65b404
Add missing unique constraint to KeyPair model.

Added a missing unique constraint ("name", "user_id") to KeyPair model
(this constraint was in db schema but not in model definition).

blueprint db-enforce-unique-keys

Change-Id: Id231bca256e0cb39fcd8068acc7039240326fde2
Remove "#!/usr/bin/env python" from .py files under nova/cmd

Fix bug 1178543

Now in Havana, all nova service script start up logic are moved to
nova/cmd and those files are not simply python script but python
files, so there is no need to still keep "#!/usr/bin/env python"
for those files since they won't be run directly as scripts.

Change-Id: Ic102215dc0200ec1f6b47951bef31d58b08022ef
Use Oslo's `bool_from_string`

Oslo provides an equivalent implmentation of `bool_from_str` so we
should switch the code to use that instead.

Change-Id: I382f23af2468e276ae4342dff18cf06e1c24b755
Pass the proper admin context to update_dhcp

Bug 1180111

Commit 14e2ed3ace769c4deaca3c48a2fa59863f637a5f introduced changes
to contexts passed around during resize. One of the calls to
update_dhcp was missed and was causing stack traces on
resize-revert.

Change-Id: Ib7bec51324c7bced009407af13a7fff7a724e020
Merge "Fix response from snapshot create stub"
Merge "Cleanup create flavor tests"
Merge "Cleanups for create-flavor"
Merge "Remove "#!/usr/bin/env python" from .py files under nova/cmd"
Merge "Use Oslo's `bool_from_string`"
Merge "Optimize db.instance_floating_address_get_all method"
Merge "Refactored tests for db.key_pair_*() functions."
Merge "Add missing unique constraint to KeyPair model."
Merge "Pass the proper admin context to update_dhcp"