Make baremetal support metadata for ephemeral block-device-mapping

Make baremetal driver set instance['default_ephemeral_device'] to
/dev/sda1 since we are using the same device for root(sda3) and
ephemeral(sda1)

Change-Id: Ib2076198eacb0ea61706043b42d673c35d26f5d1
Partial-Bug: #1239524
Added monitor (e.g. CPU) to monitor and collect data

This patch gives a monitor interface for users to add their own monitors to
monitor on compute nodes on the compute manager.

The compute manager loads the monitors and gets the metrics, and sends to
the scheduler for utilization based scheduling.
The patch also gives a sample to collect CPU utilization data by libvirt
driver. The patch brings a new API get_host_cpu_stats() in class
ComputeDriver, and libvirt has implemented that in the patch.
For other virt drivers, it has not been implemented yet (TODO).

This is part of the blueprint utilization-aware-scheduling and the
blueprint generic-host-state-for-scheduler.

Change-Id: I4cd4f972c5c1cf6242a77aaeb9514c8a0d4faa0d
Fix libvirt evacuate instance on shared storage fails

When evacuate instance which has config drive enabled on shared storage,
disk.config file can't be created because of permision error, chowns
disk.config if it already exists.

Change-Id: I20bafc3482ead30297ad5402a09e97141816f4d1
Closes-Bug: 1247526
Add v3 api samples for shelve

Adds api sample tests and api samples for shelve

Partially implements blueprint v3-api-unittests
Partially implements blueprint v3-api-specification

Change-Id: Ib485ab042a340c4672ad01fb35d065fd52889b07
Add context as parameter for resume

Now for KVM when resume an instance with block storage, nova
compute will throw exception and failed to resume the VM.

The root cause is that when resume a VM with block storage,
libvirt driver needs to call conductor via rpcapi to update
block device, but the function of resume() do not have context,
this will cause RPC api failed.

Change-Id: I712777ed1d893a2b6463d30c407b0a677e37b602
Closes-Bug: #1241337
Add context as parameter for two libvirt APIs

When finish_revert_migration is called, the caller of
finish_revert_migration already includes context as a parameter,
but finish_revert_migration did not reuse this parameter and still
re-generate the context inside finish_revert_migration, we should
add context as a new parameter for finish_revert_migration so that
the functions inside of it can reuse context when needed.

For the function _create_domain_and_network in libvirt/driver.py,
it set context as an optional parameter, but context isn't really
an optional parameter for this method. We should always pass a
context down because it might be needed somewhere inside
_create_domain_and_network().

The patch includes two parts:
1) Add context as a new parameter for finish_revert_migration
2) Set context as a required parameter for _create_domain_and_network

Change-Id: I72d131fc8dce903400e3080d51ba0fc0a1320751
Closes-Bug: #1251261
Remove "set()" from CoreAPIMissing exception

When some core v3 API extensions are not loaded, a CoreAPIMissing
exception happens like the following example:
  CoreAPIMissing: Core API extensions are missing: set(['keypairs'])

"set()" is used only for comparing the loaded extensions and the core
extensions. It is better to remove it from the exception message.

Change-Id: Iddfa69931064a6adb6e3aa7d6efaeb28260be5e0
Fix log message format issue for api

There is a log message format typo in quota_classes api,
this patch fix it.

Change-Id: Idfb9fb16e4184e226b56bf05ffcaf9fb174feaff
Remove nullable=True in models.py which is set by default

Tiny change: nullable=True is set by default, no need to use it explicitly.

Change-Id: I28883f60a0319d4834913fcabe3a3c04410175c2
XenAPI: Fix caching of images

Clearing of the cached images' name_label means it can't be found in future.
Name label of cloned VDI should be cleared so it is not found by the
caching functions.

Main impact of this is in test scenarios where the VM is always deleted, but
a more subtle impact could be data leakage.

Change-Id: I6bb80443d31128b7d5d47e4b252db5eb8ab86940
Closes-bug: 1254714
Wrong handling of Instance expected_task_state

When Instance.save called the expected_task_state parameter can be
passed to it in order to specify what is the expected task state.
There many cases when we would expect that there no task state
for the vm (task_state=None in db). Currently the
expected_task_state=None is overwritten by the default substitution in
the save() arguments and due to this not passed correctly to the
db.instance_update_and_get_original method call.

Closes-Bug: #1225659

Change-Id: I84fd2f7e2c50c5f34c84f713d6afc040524a8078
Remove console 1.X rpc api

A previous change adding support for the 2.x rpc interface but retained
compatibility with 1.x as a transition point.  This commit removes the
old API from the server side.

UpgradeImpact

Part of blueprint rpc-major-version-updates-icehouse

Change-Id: I8a5c4c45baaf237f5be38f6024d5338c8183d1a6
Add V2 rpc api for cert

Add support for the 2.0 cert rpc API.  This commit retains compatibility
with the older 1.X API to allow continuous deployment without any downtime.

The v2 rev of this API is really simple.  It removes the
get_backdoor_port() method, which was moved to the base rpc API common
to all services in havana.

UpgradeImpact - Deployments doing continuous deployment should follow this
process to upgrade without any downtime with the consoleauth service:

1) Set [upgrade_levels] cert=havana in your config.

2) Upgrade to this commit.

3) Once everything has been upgraded, remove the entry in
[upgrade_levels] so that all rpc clients to the nova-cert service start
sending the new 2.0 messages.

Part of blueprint rpc-major-version-updates-icehouse

Change-Id: Icab0d5f380f43c454c166fa3479dacda74d89a02
Remove cert 1.X rpc api

A previous change adding support for the 2.x rpc interface but retained
compatibility with 1.x as a transition point.  This commit removes the
old API from the server side.

UpgradeImpact

Part of blueprint rpc-major-version-updates-icehouse

Change-Id: I0a5d14fc3cbf374744049269883fc14a4850f597
Corrected typo in host_manager

Change-Id: I6173e00000c7245bf190165182e2242a540aff0d
Merge "Make baremetal support metadata for ephemeral block-device-mapping"
Merge "Remove nullable=True in models.py which is set by default"
Merge "Added monitor (e.g. CPU) to monitor and collect data"
Merge "Add v3 api samples for shelve"
Merge "Remove "set()" from CoreAPIMissing exception"