Extend API schema for "create a server" extensions

Some v2.1/v3 APIs(create/update/rebuild server) contains the API
extension feature, it searches extension methods with its method
name and operates them automatically.
It is necessary to change the API schemas also automatically based
on the API extension loading condition, because the API extensions
add API parameters.

This patch adds API schema extensions which are implemented with the
same mechanism (stevedore library) as the API extension for "create
a server" extensions. As a sample of API schema extensions, this
patch adds the schema of keypair extension.

Partially implements blueprint v3-api-schema

Change-Id: I972d648546b1fcb37c6ad5e12a0a49ce810a35f9
Improved error logging in nova-network for allocate_fixed_ip()

When a Nova deployment runs out of fixed IP addresses, allocating
another IP ends with stack trace without clear explanation.
To prevent such behavior this patch introduces few try-except blocks
that writes appropriate error message to the log file and return
better error code via API instead of stack trace.

Change-Id: I8111ae883719ad693113e1d3bfedc8685427c55f
Closes-Bug: #1218572
Add missed discoverable policy rules for flavor-manage v3

Add discoverable policy rule for v3 extension flavor-manage,
Although without this patch, it also works. But that's used to
indicate to user there is option for flavor-manager discoverable.

Change-Id: I23f8bbaccfa104a12e4a4c9eea8bf04107b57d43
Diagnostics: add validation for types

When creating diagnostics the calling application is able to pass
cpu, nic and disk diagnostics. This patch validates that those are of
the correct type.

TrivialFix

Change-Id: Id76c37e2f3ff50b0029bb1fa26348e43aee432f1
Add instanceset info to StartInstance response

Currently startinstance response doesn't have the
instanceset information with InstanceID, current state
and previous state. It just returns the "True".
As per the AWS API reference document, the StartInstance
response elements should include the instanceset information
as below:
<StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-01/">
  <requestId>req-a7326465-5ce2-4ed6-ab89-394b38cca85f</requestId>
  <instancesSet>
    <item>
      <instanceId>i-00000001</instanceId>
      <currentState>
        <code>16</code>
        <name>running</name>
      </currentState>
      <previousState>
        <code>80</code>
        <name>stopped</name>
      </previousState>
    </item>
  </instancesSet>
</StartInstancesResponse>

Included the instanceset in to startinstance response elements
and updated the test cases for startinstance response elements
in nova/tests/api/ec2/test_cloud.py file.

Change-Id: I08ef7ed88f983b66a30c76d6b7b754222097a03b
Closes-bug: #1321220
Migrate test_glance from mox to mock

A few tests in test_glance.py are still using mox. Update these
remaining tests to use mock, as this is the general direction in
which the project is moving.

Change-Id: I81fc36467b158625f29593c7173542f843244311
Add expire reservations in backport position.

Change-Id: If0e58da50ebe9b50b414737a9bd81d93752506e2
Related-bug: #1348720
Merge "Add instanceset info to StartInstance response"
Merge "Add missed discoverable policy rules for flavor-manage v3"
Merge "Add expire reservations in backport position."
Merge "Migrate test_glance from mox to mock"
Merge "Diagnostics: add validation for types"
Merge "Improved error logging in nova-network for allocate_fixed_ip()"
Merge "Extend API schema for "create a server" extensions"