Don't update DB records for unchanged stats.

Change-Id: I6eb0adba12676cf057c92fb0b54431cfe6a76210
Fixes encoding issues for nova api req body.

* Ensure utf-8 encoding for POST/PUT body for api requests
* As per https://wiki.openstack.org/wiki/Encoding.

Fixes bug #1180344

Change-Id: Iea0f16b0c024795fb3aee1cd38bb54ee9da6d90d
Fix error in instance_get_all_by_filters() use of soft_deleted filter

Change-Id: I7c2fab48944e34765b3fff8ce10bc64a5cd826c8 introduced the
'soft_deleted' filter to the above method to tweek the behavior of the
existing 'deleted' filter. In doing so, an error was introduced that
changed the original behavior of the 'deleted' filter when used by
itself, in how it treated both soft- and hard-deleted instances the
same.

The original merged patch did not include test coverage for the changes
made to the db api. This change fix the error so that the original
behavior of the 'deleted' filter is restored while also adding full
test coverage for the modifications to the db api that has already
merged.

Finally, the support method create_instances_with_args() used by the
new tests was renamed create_instance_with_args() to reflect that
when called, it just creates a single instance.

Resolves bug 1181865.

Change-Id: Ibb82af09d3876904455ca7c93e14e9722ed31d35
Add missing tests for nova.db.api.agent_build_* methods

blueprint db-api-tests

Change-Id: If8f8a3f02bc0ea73b9174caad60107c7d87f62c0
Raise AgentBuildNotFound on updating/destroying deleted object

Methods below should raise an exception when attempting to operate
with deleted AgentBuild objects:

 nova.db.sqlalchemy.api.agent_build_destroy()
 nova.db.sqlalchemy.api.agent_build_update()

Fixes: bug 1181967

Change-Id: If6df202afb7ea41634c35f7a52988e19677f4d65
Using unicode() to handle image's properties

Replace str() to unicode() to allow nova-api work well with the fix I
did in glanceclient (https://review.openstack.org/#/c/29245/6).

Fixes: Bug #1180377

Change-Id: I31e532bb50e12e355b9dd26c9ce1e129da858cbe
Signed-off-by: Zhi Yan Liu <lzy.dev@gmail.com>
Remove tempest hack for create/rebuild checks

A bug in Tempest required us to check quotas before requesting image
information. Now that this has been fixed upstream, we can remove our hack to
get around this.

Change-Id: I7ef1cd2f4f641fb5616945b66740820a4003b66d
Add node as instance attribute for notification

Fix bug 1181900

In havana release, node is not set as instance attribute and node
indicates the hypervisor where the instance reside in, we should
set node as instance attribute for notification.

Change-Id: I872fba626ef3e321d88cf60fc730df6cf4612c86
Fix config drive code logical error.

Image id has changed to uuid, so bool value can't be a image ID
any more, remove unnecessary test code.

fix bug #1181991

Change-Id: I420e4cdb848401375b347d43e06343efaa7bf5fc
API Extensions framework for v3 API Part 2

This is the second patch for the new extension framework
which is only to be used by the Nova v3 API.

- Adds tracking of extensions loaded and allows
  extensions access to this information
- Adds core API functionality as extensions
  - 'server'
    - Adds an entry point that other extensions can
      use to modify the server create arguments without
      having to modify the server extension itself
    - TODO: Will have to add more entry points as other
      extensions are ported. Delaying adding entry points
      now so they can be tested as they are added.
- Adds port of os-keypairs extension
  - This is an example of a controller extension in the new
    framework
  - This is an example of using the server extension entry
    point to add functionality without modify the core API code
  - Ports tests for the os-keypairs extensions
    - Adds v3 API fake specific code for tests

This completes the bulk of the new extension framework. Porting
of the server tests will be done in future changesets as more
of the core API is ported across as the tests are dependent
on multiple core APIs.

Partially implements blueprint v3-api-extension-framework

Change-Id: Ibadb5bbe808c27d2f4afebe65c06a92576397085
No relevant message when stop a stopped VM

When user tries to stop a stopped VM, there is no need to stop it again,
and We need return it's vm_state.

Fixes bug 1181934

Change-Id: I71772dfcead440cb49b6ccdbb4e1a891475bb75e
Fix internationalization for some LOG messages

Fixes a couple of LOG messages to support internationalisation

Change-Id: Ifba6beb6a33e3969522776114a69def9eaa5262b
Rename policy auth for V3 os-fixed-ips

Renames name used to for policy authorisation for the
V3 os-fixed-ips to os-fixed-ips with a "v3:" prefix (as
per ML discussion)

Change-Id: Ia599c29d7f45153ef47605b6e2a7061fc28ff7cc
Delegate authentication to quantumclient

Quantumclient can deal with authentication, getting the token and
refreshing it when needed. There should be no need for nova to do
those explicitly. Additionally nova can save some time not having
to recreate the Client object on each request.

Fix a couple of places that relied on the exceptions module being
imported inside quantumv2.

Part of blueprint fewer-networking-token-checks
Fixed bug 1177579

Change-Id: I007cef1f0bd688036fa45d79792e6e350c145f05
Raise exception instances, not exception classes.

Raising raw exception classes works, but is old deprecated syntax, and
may bite us later.

Change-Id: I03f41da267ce5cbfc5ea98c531acc9a9b13e082a
Support Cinder mount options for NFS/GlusterFS

When connecting to an NFS or GlusterFS volume, use
mount options specified in the "options" field of
the connection_info structure to perform the mount.

This allows the Cinder volume service to specify mount
options rather than only being able to configure them
on the Nova compute node.

Fixes: bug 1185180
blueprint cinder-volume-options

Change-Id: I81a50a2ceb4da4d639f6471b2114a904e5d1a42e
Merge "Raise exception instances, not exception classes."
Verify that CONF.compute_driver is defined

The compute_driver parameter is a mandatory parameter only for nodes
running the Nova compute service. However Other Nova services like
Nova API actually call the compute_driver_matches() function.

Change-Id: Iac7cd46c6bdb4268cfbc650dcde0c95e69545f04
Fixes: bug #1184641
Make testr preserve existing OS_* env vars values

Values for OS_TEST_TIMEOUT, OS_STDOUT_CAPTURE and OS_STDERR_CAPTURE
environment variables are fixed in .testr.conf now. It should be possible
to override them for each tox/runtests.sh call or for the current shell
session without making changes to .testr.conf.

Fixes bug 1182416.

Change-Id: I6c7839fa78b53ac8ea358ce0143a00931da96a9e
Clean up failed image transfers in instance spawn

Boot one instance with powervm driver, will transfer the image
file to host. Need clean up failed image transfers that may occur
during instance spawn.

Fixes bug #1173017

Change-Id: Iff5ecd32e201333567a6a4de1d3796e78ea5dc0c