Fix wrong description when updating quotas

when updating quota for a resource, with 'force_update=false', an
exception will be raised when the new value is less than the used quota
values(used and reserved). This patch changes the description of
exception.

Change-Id: Iede70444341817afb6953eb604fe4de186622916
Closes-bug: #1243062
Stored metrics into compute_nodes as a json dictionary

The compute manager uses plugins to get the metrics information of each node.
And then sends and stores in DB for the scheduler to read and do scheduling.

The patch reuses table compute_nodes and adds a new TEXT column to store the
metric data as a json dictionary.

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

Change-Id: I4d20565567e9907cfcc92b1c1b15f3b35a806797
Signed-off-by: Shane Wang <shane.wang@intel.com>
Fix migration 185 to work with old fkey names

Migration 133_folsom.py accidentally changed the name of the FK
constraint on instance_info_caches from instance_info_caches_ibfk_1
to instance_info_caches_instance_uuid_fkey and on virtual_interfaces
from virtual_interfaces_ibfk_1 to
virtual_interfaces_instance_uuid_fkey meaning databases who have
upgraded from before folsom have the old fkey.

This patch adds a check for those with the old fkey name to make sure
it is dropped before changing unique constraints (as is required by
MySQL). It also fixes the fkey name to be as defined in 133 if it
wasn't before (which will persist on downgrade being consistent with
those who have come in after folsom).

Closes-Bug: #1245502

Change-Id: Ib0dcd04fcb9ed776c76d40561181abad2e14f76f
Fix interface-attach removes existing interfaces from db

The following commit 394c693e359ed4f19cc2f7d975b1f9ee5500b7f6 changed
allocate_port_for_instance() to only return the ports that were created
rather than all of the ports on the instance which broke the attach-interface
code.

This patch fixes this issue by remove the sync decorators from:
allocate_for_instance, allocate_port_for_instance, and
deallocate_port_for_instance to just _build_instance_nw_info which
is called in all these cases instead.

Closes-bug: #1223859

Change-Id: I66eb0c0ab926e0a8d1e2c9cfe1f7fd579ea3aa27
Make the vmware pause/unpause unit tests actually test something

The pause/unpause tests for vmware were just passing so this patch
actually makes them test the pause/unpause methods for the
VMwareESXDriver and VMwareVCDriver classes.

Closes-Bug: #1237679

Change-Id: Idf7c6e6f9542b9ab4dd2ab710597f1a198889dfa
Make v3 admin_password parameters consistent

There are API parameters "admin_password" and "admin_pass" on some APIs:
 * AdminPasswordController: admin_password
 * EvacuateController     : admin_password
 * RescueController       : admin_pass
 * ServersController      : admin_pass

These parameters mean the same thing, it is the admin password of a vm
instance. They should be the same parameter name because of the meaning.

DocImpact

Partially implements bp nova-v3-api

Change-Id: I452672e064d0dc4a1d5700bb96c01de8087f33d8
Add log_handler to implement the publish_errors config option

Synced from Olso.
Commit Id is Ibf28ba17f81b5ddeda653f6a3501ecac18ffcd42

This handler sends all error logs as rpc notifications.
Note: when using publish_errors you also need to set the
notification_driver option too.

Change-Id: Ic97b9c8b84d51c84a53ace5b86cc2e72c744f136
Closes-bug: #1240349
Remove unnecessary steps for cold snapshots

Up until now when we created cold snapshots we were stopping the
instance, create an internal snapshot, extract the snapshot to a file
and then delete the internal snapshot before bringing up the instance.

If the instance is shut down, there's no concurrent writer, so the image
can be directly extracted without taking an internal snapshot first,
because the snapshot and the current state are the same.

In this patch the creation and deletion of the internal snapshot are
removed to eliminate the extra steps and optimize the creation of
snapshots a bit.

Closes-Bug: #1242819
Closes-Bug: #1247185

Change-Id: I429fa2e1e26aea321eecbf14edd11263fff525ae
image tests: replace assertEquals with assertEqual

assertEquals will be deprecated in Python 3.

This is part of blueprint assertequal

Change-Id: Iabce801165527856e410ac11bfb2842c26c9ad2e
domainEventRegisterAny called too often

Changeid I090765802bfe443440f16722bc7c43b6280fe56a fixes
bug #1240905 but introduced a bug whereby domainEventRegisterAny
is called on every call to _get_connection.

Change-Id: Ifafc6a4c172b1521d62988ccbb3a2f51a95e323f
Fixes: bug #1250135
xenapi: Move settings to their own config section

This commit changes xenapi_* config options to their own section
with the xenapi_ prefix removed where appropriate.  The change
is done in a backwards compatible fashion such that previous
nova.conf files still work.

As part of this update the sample file and text strings are
also updated to reflect new config options.  Test cases have
been adjusted to handle the config hierarchy.

2642897d6f5b8a211424519d99feddc89c3bf180 was followed to
implement this change.

Change-Id: I2e9f720ddce284fc112d6a5651fd277e6e31a17a
Closes-Bug: 1207253
DocImpact
Merge "Make the vmware pause/unpause unit tests actually test something"
Merge "image tests: replace assertEquals with assertEqual"
Merge "xenapi: Move settings to their own config section"
Replace assertEquals with assertEqual - tests/etc

The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals
therefore we should use assertEqual instead.

This is part of blueprint assertequal

Change-Id: I5ecb36332b9353b7010a4f977813ff0295738014
Remove dup of LibvirtISCSIVolumeDriver in LibvirtISERVolumeDriver

LibvirtISERVolumeDriver is an almost copy of
LibvirtISCSIVolumeDriver.

Change-Id: I7f71be69df6dc203508114fc67f55b7da2b0e529
Moved quota headroom calculations into quota_reserve

Moved headroom calculations into quota_reserve and modified headroom
calculations to take into account -ve quota limits (unlimited) on
cores and ram.

Updated test cases to generate OverQuota exceptions with new headroom
parameter.

Added new tests for 'unlimited' quotas to test_quota.py in
 QuotaIntegrationTestCase and DbQuotaDriverTestCase classes.

Add Exception kwargs checking for OverQuota and QuotaError exceptions.

Change-Id: I855b0cad495182c5c4ee42b2acf5eedd198557b5
Closes-Bug: #1224453 min_count ignored for instance create
xenapi: Fix regression issue in agent update

Agent updates must be processed after guest networking is configured

Change-Id: I7994154ea09befe07396b4e99d43157d268fd6b1
Closes-Bug: 1250162
xenapi: Fix agent update message format

Fix the agent update message send so Windows guests will work

Message must be formatted: "url,md5sum"

Change-Id: I675cc5a7ca522696eab1820c14c48361ff7e0f74
Closes-Bug: 1250165
Merge "Add log_handler to implement the publish_errors config option"