Push 'Error' result from event to instance action.

Currently a failed event stores an 'Error' result but in order to see
which actions have failed it would require grabbing each one through the
api to see the events.  This patch adds 'Error' to the message field of
the instance action so that any actions with failures can be seen from
the initial listing of actions on an instance.

Change-Id: Ieeb798c47211ab00fe5b767dc1f18a665549ba01
Standardize the coverage initializations.

Now when we measure coverage repeatedly, the coverage data of
nova-api is accumulated but the ones of other nova services are
reset each time.
This is due to create new "coverage" class each time
"_start_coverage_telnet" method is executed.

This patch limits creating "coverage" class the first time
the method is executed.

Fixes bug 1122720

Change-Id: Ia900c96113bee65362ccb7c4c1975535d814d835
Return proper error messages while disassociating floating IP

Currently, when a floating IP is not associated with an instance, and if we try
to disassociate it, a response likes "HTTP/1.1 404 Not Found" will be returned,
it is not proper, so change it to "HTTP/1.1 422 Unprocessable Entity" with body
likes '{"computeFault": {"message": "Floating ip 172.24.4.225 is not associated
with instance a33857af-b18b-4b88-a5cc-7d84c7fd41c8.", "code": 422}}'.

Fixes bug: #1129719

Change-Id: I18194ccf59edb5eb2bcd52a65f38d5632fef95d3
Ensure that FORWARD rule also supports DHCP

The previous fix only addressed the INPUT rules and not the
FORWARD rule.

Adds FORWARD rule to ensure that DHCP traffic is forwarded correctly.

Fixes bug 1131223

Change-Id: Ie0d365ba1ba1014bdd2bfc944123c17c4e415d6e
Fixes live migration with attached volumes issue

Fixes Bug: 1140917

Live migration fails when there are volumes attached to the instance

Change-Id: I27b39ac41e97840d2a60006b1c74f6d256bc53b7
Updating powervm driver snapshot with update_task_state flow

Fixes bug 1136359

Without this change snapshot still works but instance task state
does not get updated correctly and nova logs will show expected
task state erros from compute manager.

Also added a snapshot test.

Change-Id: I0f4ed24aa82a66fafc4b6813d017618ae07b4751
Fixes disk size issue during image boot on Hyper-V

Fixes bug: 1135155

The local root disk size provided in the instance flavor was not properly
taken into account in the Hyper-V driver, this patches provides a
fix for this feature.

In order to resize VHD images with differencing disks (CoW), the cached
base disk is copied to a new file, which is resized to the size
specified in the flavor and cached. This is necessary due to the fact that
differencing VHD disks cannot be resized.

The procedure described above is applied during image spawn, resize and
live migration as needed.

Trying to spawn an instance with a local root disk size smaller than the
image VHD max. internal size will result in an error.

Change-Id: I04f18f0e25c92ed1e1f9f6f18750329a3f9f1711
Fix an error in compute api snapshot_volume_backed bdm code

Stumbled upon an error similar to the one found in
https://review.openstack.org/#/c/23354/ where a dbm dict
item is tried to be read as an attribute.

Looked at the next couple of lines and discovered more
cases of this error.

Updates to some api tests that contain faulty fakes that
hide this error adds some coverage for this error. Rebased
this patch on the above mentioned review to be able to
change the tests, since the code path is the same and they
now hit both of these errors.

Resolves bug 1142734.

Change-Id: Ie639cd483334b6222085a139159da47ce6fa3671
fix postgresql drop race

when running under testr there is a chance that we enter
reset_databases for the postgresql tests at the same time for both
general and baremetal tests. In this case the pg admin commands
could fail, as pg gets really strict about having 2 users trying
to do admin commands at the same time on a single database (in
this case the magic template1 db, that we need to use because
you can't drop the db you are currently on.)

Solve this by breaking out the postgresql reset case into a
seperate function and using @lockutils on it.

Change-Id: I31555ef5aae27f31daf7cbbae61072a8d7deb255
Remove unused db calls from nova.db.api

* iscsi_target_count_by_host
* iscsi_target_create_safe
* reservation_destroy
* volume_get_iscsi_target_num

Change-Id: I0c357a6398509150e7ac987826341cd1e79f0075
Imporove db.sqlalchemy.api._validate_unique_server_name method

This method is called by instance_create and instance_update.
If parameter CONF.osapi_compute_unqiue_server_name_scope is set to
'global' or 'project' then it has terrible performance.

Algorithm was next:
1) Get all instances and all connected data (5 joinloads..) in global
   (or project).
2) Compare hostname with hostnames in instances (locally)

Now:
1) Get only count of instances with same hostname in global (or project).
2) If count > 0 raise Exception.

Change-Id: I35ea121c3f906b4fff11c38bafa2ab33200bd6b2
docs should indicate proper git commit limit

The nova gate should recommend 50 characters or less for a git commit
but actually enforce 72 characters.

This patch changes the hacking.rst docs to indicate the actual limit
is 72 characters rather then 50 characters.

Change-Id: I47f1f1f1007f5744bf1fef419df7e033803b4a53
Fixes: Bug #1144840
Rename source_(group_id/ip_prefix) to remote_(group_id/ip_prefix)

Fixes bug 1144426

Change-Id: I28735aea05738487861e477aaa3b0a3cec081821
Read baremetal images from extra_specs namespace.

Baremetal PXE driver should read deploy_kernel_id & deploy_ramdisk_id
from the 'baremetal:' namespace within instance_type['extra_specs']
so that it doesn't conflict with ComputeCapabilitiesFilter any more.

Fixes bug 1129485.

Change-Id: I84b3acb2ed83dc2b1ff8f1a21ca1d95f7d25751a
Merge "Remove unused db calls from nova.db.api"
Merge "Push 'Error' result from event to instance action."
Merge "Standardize the coverage initializations."
Merge "fix postgresql drop race"
Baremetal deploy helper sets ODIRECT.

Baremetal deploy helper should set oflag=direct when dd'ing images onto
iSCSI targets, so that it doesn't waste the local page cache.

Fixes bug 1114633.

Change-Id: Ia674afb34aff7b842cfcd520ecb7b75dc21944fa
Prevent reboot of rescued instance.

Do not allow rebooting an instance in the RESCUED state.  This will
revert the instance back into an ACTIVE state, which may still be
broken.  Require an explicit unrescue, instead.

Fix bug 1126163.

Change-Id: I144163666767923e3beb0a82e687066d1f3a0441