Fix extra metadata didn't assign into snapshot image

create_image action API accept metadata parameter to add extra
metadata into snapshot image. But the current code doesn't work
for snapshot of volume based instance. This error is because the
code use var 'props' to store extra metadatas, and the code use
same var to store root bdm metadata later, then the extra metadata
is overwritten by root bdm metadata. This patch use another var
'properties' to store root bdm metadata to avoid overwrite the
extra metadata.

Change-Id: I2224905f596690e22aa71dc6541284f005ebba9d
Closes-Bug: #1347355
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
Handle FloatingIpPoolNotFound exception in floating ip creation

If an invalid pool is specified when creating a floating ip
with neutron as the backend a FloatingIpPoolNotFound exception
can be raised. This change handles the exception at the API level.

Change-Id: Iac46d86a11f2c1da0ed7e7861cdb87fd4d4b4c6c
Closes-Bug: 1352141
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
Merge "Fix extra metadata didn't assign into snapshot image"
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"
Add method for deallocating networks on reschedule

The original call to dhcp_options_for_instance() is not a great way to
check whether deallocation of networks should happen on reschedules.

This adds a new virt driver method 'deallocate_networks_on_reschedule'
which can be used by a virt driver to say whether reschedules should
deallocate networks first. This defaults to False and modifies the
baremetal virt driver to return True. Ironic virt driver will also need
to return True.

Closes-Bug: 1342919
Change-Id: I54a3252ab15e2d8b596ccc90eb4755405021f1da
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"
Merge "Add method for deallocating networks on reschedule"
Merge "Handle FloatingIpPoolNotFound exception in floating ip creation"