Fixes Hyper-V VHDX snapshot bigger than instance

In Hyper-V, the deployed images will be extended having their
metadata size added to their base image size. This may lead to
snapshots bigger than the flavor size.

This patch adds support to the V2 utils module, so that the
maximum internal size of a requested image may be calculated
in a similar way it is done in the V1 module.

VHDX format specs:
http://www.microsoft.com/en-us/download/details.aspx?id=34750

Closes-bug:  #1231911

Change-Id: I0d6aacb275f8af24554d3e8b6f04fe8a454b913f
Prevent caller from specifying id during ComputeNode.create()

The patch is to remove id when it was set before creating a compute
node in objects, so it can be generated automatically.

And check if the node exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: Ib808643bff24b683ef330b5a1be5bc68ece30184
Prevent caller from specifying id during Service.create()

The patch is to remove id when it was set before creating a service
in objects, and check if the service exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: I688bfc98234f4bc27fb15474e05c7f25753efaf7
Prevent caller from specifying id during KeyPair.create()

The patch is to remove id when it was set before creating a key pair
in objects, and check if the key pair exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: I07609500e1135f54929265e06193c48e1bb083db
Prevent caller from specifying id during Migration.create()

The patch is to remove id when it was set before creating a migration
in objects, and check if the migration exists before it is created.

Related to blueprint icehouse-objects.

Change-Id: I37ff279f5f74d17ce9c173458ff35826fb10f143
Fix bad log formatting

Oslo blueprint logging-handleerror-raise-exception, will allow us to raise
exceptions raised during logging, using that code these are two outstanding logs
that have incorrect formatting.

Change-Id: Iea26bb9905cd7501094eaef8d932e78627cdbd5d
Rewrite InstanceAction object test cases using mock

This change rewrites the InstanceAction object test cases as a
groundwork for other InstanceAction changes to come.

This is a part of: blueprint make-instance-action-use-objects

Change-Id: I73eafa778bc0b558fe3c3497ec6892f52e8088db
libvirt-volume: improve unit test time

A number of tests would invoke code that would sleep. This
patch adds a mocked function for the sleep.

Change-Id: I804a86e3b8b750919cf7a9547ef514f833a5fd49
Related-bug: #1279820
Fix the indents of v3 API sample docs

There are some indent typos in v3 API sample docs.
Most API samples' indents are 4 spaces, but some samples' indents
are 2 spaces. This patch fixes them.

These typos have been found during the work for auto-generating API
API sample docs from API validation schemas. The auto-generator'll
output API sample docs with json.dumps() method and that would make
the difference between current docs which are fixed with this patch
because the generator would make API samples consistent.
This patch's purpose is also for preparing the generator.

Change-Id: Ieb6e587fcf4c01c128199950db93e1087bc43f41
Add resource tracking to unshelve_instance()

When unshelving an offloaded instance, a new host is scheduled for
the instance. However, the call to unshelve the instance on the new
host does not go through the resource tracker, which may lead to
over-allocation of the hosts resources.

This change adds resource tracking to unshelve_instance().

Change-Id: I682713c8ebc6276ac49822db5c8efc373d5b8f4d
Closes-Bug: #1241017
Adds service request parameter filter for V3 API os-hosts request

Both V2 and V3 API do not support service request parameter filter
for os-hosts request. For V2 API, there is no need to having two
different clouds having different APIs (one with service filter
one without) but just take V2 API as a document bug. This patch
will only fix V3 API.

DocImpact
Adds the ability to filter a hosts list request by service for
the V3 API.

Change-Id: I42163707049300b0dee677558ed49280bcc7369d
Partial-Bug: #1224763
Merge "Fix the indents of v3 API sample docs"
Merge "Adds service request parameter filter for V3 API os-hosts request"
Merge "Fix bad log formatting"
Merge "Prevent caller from specifying id during ComputeNode.create()"
Merge "Prevent caller from specifying id during Service.create()"
Merge "Prevent caller from specifying id during KeyPair.create()"
Merge "Prevent caller from specifying id during Migration.create()"
Add 'use_slave' to instance_get_all_by_filter in conductor

When the use_slave parameter was added to instance_get_all_by_filter in
the db layer and nova object layer it was missed in conductor, causing a
failure in the _poll_rescued_instances periodic task.  This adds the
parameter where necessary.

Change-Id: I16ab29730d72b2e2941766b5b12568976facec39
Closes-bug: 1279358
Merge "Rewrite InstanceAction object test cases using mock"