Stylistic improvement of models.ComputeNodeStat

The patch is aimed at improving the readability of models.ComputeNodeStat.

Here, we rename the 'stats' attribute of the class to 'compute_node' (due to
the fact that the corresponding relation actually maps to ComputeNode class,
not to ComputeNodeStat). We also rewrite the relationship() method call to
make it stylistically conforming with the analogous 'service' relationship
in the ComputeNode class: we add the 'foreign_keys' parameter, wrap the
'backref' parameter into a method call and remove the auxiliary 'primary_join'
variable.

Change-Id: I2b1f27b4c1d06f364af01fc82d3490fd3bbf4ac0
Closes-Bug: #1215390
tenant_id implies all_tenants for servers list in V3 API

Makes tenant_id imply all_tenants is also enabled unless
explicitly disabled when a request is made for a list of
servers. This only occurs if the requestor is an admin. The
change is only made for the V3 API as although this behavior is
more intuitive it is too late to change it for the V2 API.

Change-Id: Ia84e62c8dc80ac3a2f16aee3620af31987cce570
Partial-Bug: 1185290
Catch exception while building due to instance being deleted

In run_instance() a instance_update() call in _start_building() can
result in a UnexpectedDeletingTaskStateError if the instance gets
deleted while being built.Since this is an expected situation, we
don't want this exception written in the logs or worse, the instance
be set to error state. Instead catch this and raise a proper
BuildAbortException that gets handled above this call.

Change-Id: Ib9d3dd22b33b104f1593d534876a5387df81d11c
Closes-Bug: #1223843
Checking existence of index before dropping

Migrations modifying indexes drop and recreate the index.
If an index does not exist dropping would fail the migration.
As part of this fix, checking if index exists before dropping it.

Fixes bug 1243553

Change-Id: Ic75744bdccfbc516d36a9711ad6997fd86c7a722
Update quota-class-set/quota-set throw 500 error

The server doesn't check whether the parameter "quota_class_set" is in request
body.So the 500 error has been thrown.

We should catch the KeyError and transfer the KeyError to
400(HTTPBadRequest) instead of 500.

Change-Id: I431a836bd35f846790497d6179515e8d559e2cd0
Closes-Bug: #1249222
Shrink the exception handling range

On evacuate action API, the exception handling for getting API
parameters is wide. This patch shrinks it to necessary range for
code cleanup.
In addition, this patch adds some negative tests for the lack of
"onSharedStorage" parameter.

Change-Id: Iccfa9d455758af432b5bcbb33842034f07e8fdc3
Add V3 API sample for server's actions

Adds api sample tests and api samples for server's actions

Partially implements blueprint v3-api-unittests

Change-Id: I4b420f09f9fc9a7f6fab8dbaeaa9b93631909255
VMware: fix snapshot failure when host in maintenance mode

The root cause is due to a bug in the VC's handling of the
VirtualDiskManager.DeleteVirtualDisk_Task API, which allows the picking
of any host in a datacenter with access to the datastore participating
in the disk deletion picked be to perform the operation, even when the
host is in maintenance mode and hence will always reject the call when
sent.

The fix uses an alternative API (FileManager.DeleteDatastoreFile_Task)
to delete the vmdk and -flat vmdk files separately. This API does not
suffer from the above-mentioned failure mode.

Closes-Bug: #1229994

Change-Id: I786365847673e5192a21b654cba951b2e7a6f291
Add V2 rpc api for console

Add support for the 2.0 console 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.  It also removes some unused parameters.

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

1) Set [upgrade_levels] console=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-console service
start sending the new 2.0 messages.

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

Change-Id: If05d041c5104b7f4e2e6b035de33cdd695c7a1ae
Include image block device maps in info

In cases for example soft/hard reboot, we were just getting volume and
snapshot block device maps. For block devices with a source type image,
Nova would fall back on a local disk location and fail.

This change allows us to include block devices with a source of an
image, so that we correctly get the right the location of the block
device.

Closes-Bug: #1245719
Change-Id: I1f726293e85183d4b84c05b635a7c606a092992f
Fix for reading the xenapi_device_id from image metadata

The xenapi_device_id is set on the image metadata.
This is used to set the device_id on the vm record
before the vm is created. Currently, when we read
the device id from the metadata we are looking at
the key image_meta["xenapi_device_id"].
But the device id is set as
image_meta["properties"]["xenapi_device_id"].

Fixes bug 1253564

Change-Id: Ide174b50db4e440401b5e6389844e7dcfc8a1c76
Imported Translations from Transifex

Change-Id: I467fbd376b2dd6b11b41e0528eeaf02f21eaa819
Merge "Imported Translations from Transifex"
xenapi: workaround vbd.plug race

XenServer 6.1 and above has issues where multiple calls to VBD.plug can
cause tapdisk to hang during the unplug.

Currently this causes issues when attaching the virtual disk to the
nova-compute VM. This happens during spawn and resize. Should any of
those operations happen at the same time, we run the risk of hitting the
above bug.

This change works around this issue by ensuring there is only ever one
VBD plug at once, per VM.

Fixes bug 1251716
Change-Id: Ie7a64c481a9e3874df9d5924fbb050ac7ab117db
xenapi: stop key_init timeout failing set password

When key-init timeout occurs, it returns None, which causes the
set-password to fail with an error casting None to int.

This code ensures it fails silently as intended.

Fixes bug 1241738
Change-Id: I080807c5728f94a6b36957efd6f2bbc44a76b1cd
Merge "xenapi: stop key_init timeout failing set password"
Merge "Add V2 rpc api for console"
XenAPI: Fix config section usage

Change I2e9f720ddce284fc112d6a5651fd277e6e31a17a introduced xenserver
sections but a couple of CONF variables were not updated to use the
new sections.

Fixed the few remaining options and add unit tests to ensure they are
caught in future.

The unit tests highlighted that the functions behaved strangely in
the cases where the default was being provided - so updated to be
clear about getting the default.

Closes-bug: 1253064

Change-Id: Ic538069cd087aa3cdc0a1f7fdb94820d5d3b22b1
Merge "Shrink the exception handling range"
Merge "Fix for reading the xenapi_device_id from image metadata"