Do not use contextlib.nested if only mock one function

There are some test cases in test_compute_mgr.py using contextlib.nested
to mock up functions even there is only one function needs to be mocked.

We should use mock.patch.object directly if only mock one function.

Change-Id: I30f05d0dcb442d426358b673f0e638ace8b85e0e
Closes-Bug: #1263602
Add API schema for v3 keypairs API

By defining the API schema, it is possible to separate the validation
code from the API method. The API method can be more simple.
In addition, a response of API validation error can be consistent for
the whole Nova API.

Partially implements blueprint nova-api-validation-fw

Change-Id: I484fc2807721b5bfe0f1a11c3811b99a13d920aa
Return policy error, not generic error

When nova net-create and net-delete are prohibited by policy, we should
raise policy violation error (403) to the user instead of service
unavailable (503) error which is incorrect.

Closes-Bug: #1260905
Change-Id: I2edc0eb09f1dc192ba47184ed24fc49e4fcd4b79
Remove unused import

Remove unused import in openstack/common/db/sqlalchemy/session.py

Sync from oslo: Ia89d749f698a9bee71f70fbb7e723a0131bfccfe

Change-Id: Ie58a585bc058775cfd0eb0934a74aeb700fd09db
Avoid unnecessary use of rootwrap for some network commands

Every time we run something as root with rootwrap, it takes about
ten times longer (setup-wise anyway). For things that don't need
to be run as root, we should avoid this hit. Nova network does
this a lot and is also slow enough to cause trouble, so this
patch attempts to address that for a few situations.

Related-bug: #1257626

Change-Id: Idc26776bf96ccfd9f50383e9d40aa47397d4e2cf
Merge "Avoid unnecessary use of rootwrap for some network commands"
Merge "Remove unused import"
Merge "Do not use contextlib.nested if only mock one function"
Merge "Return policy error, not generic error"
Merge "Add API schema for v3 keypairs API"