Fixes messages logged on Glance plugin retries

Retry logic is now being used for both upload_vhd and download_vhd,
but nova/virt/xenapi/client/session.py still had 'upload_vhd'
hardcoded in its logged messages. This change causes it to accept the
function being used as an argument and display that.

Fixes-Bug: #1265054
Change-Id: I6203aef81960078f92fa7839e47ee1c84df95745
vmwareapi: simple refactor of config drive tests

A fairly trivial refactor of multiple identical spawn
invocation calls.

Change-Id: I110df1786b4081abe72428f888c3d27430017ff1
Correct the state for PAUSED instances on reboot

If an instance is in the PAUSED state before the compute node is
restarted, it will be left in an inconsistent state (impossible to
delete and/or restart it) after the node boots again.

This patch adds a check in the periodic task sync_power_state so when
this situation is detected the instance is stopped and left in a state
from where it can be started again or deleted.

Closes-Bug: #1265494
Change-Id: I7266ace596598522c28a3839091ef50faf4463c2
remove 2 unused function in test_volumes.py

2 fake functions are not used in this test file, remove them

Change-Id: I35d374cb2cbffc0ba6d2ac761b4f7fd20b47401f
Support building wheels (PEP-427)

Universal is used to identify pure-Python module(by bdist_wheel). For
these, it is sufficient to build a wheel with _any_ Python ABI version
and publish that to PyPI (by whatever means).

Change-Id: Ic22b78ef6434ebf888c92c0a162caeabb70edf88
Make sure "volumeId" in req body on volume actions

We should check whether the parameter "volumeId" is in request body while
attaching a volume to an instance and while swapping volume.

Change-Id: I0be2ae4c80615c0304cd1a0d8ca0a4282a0867c7
Closes-Bug: #1257135
Catch InstanceNotFound exceptions for V2 API deferred delete

Adds handling of InstanceNotFound exceptions in the V2 API
deferred delete and translate them to HTTPNotFound rather
than letting them propagate up causing a traceback in the
nova log.

Co-Authored-By: Michael Still <mikal@stillhq.com>

Change-Id: I3d434f28313ae633bdcb9cef82a7b8b0020b5722
Closes-Bug: 1270803
Catch InstanceNotFound exceptions for V2 API floating_ips

Adds handling of InstanceNotFound exceptions in the V2 API
floating_ips extension and translate them to HTTPNotFound rather
than letting them propogate and causing a traceback in the logs

Co-Authored-By: Michael Still <mikal@stillhq.com>

Change-Id: Idc1a5b2e6b8cb9778d032e5e1fc8112a65fc225c
Closes-Bug: 1271047
Rename Openstack to OpenStack

Change-Id: Iacc51d8ad071c3b22b7bb6b21cff972599b59a7b
Update docstring for baremetal opportunistic tests

The db.test_migrations can test the migrations for Nova and nova
bare-metal. This patch updates the docstring on how to run those
tests opportunistically.

Change-Id: I327d688ec9af7dc0e8e0e58804bac8a3091cb727
Fix invalid facilities documented in rootwrap.conf

The values user0 and user1 do not map to valid facility values.
local1, etc.  Using user0 results in a  pri value that does not map
back to a facility of the same name in syslog.

RFC5424 suggest values values of local0 through local7.  Setting
syslog_log_facility to one of those values results in a message with a
priority that can be mapped back to the original string value.

This fix adjusts the comment in rootwrap.conf to suggest the local
prefix instead of the user prefix.

Closes-Bug #1280879

Change-Id: Ibefffb5619641b75b4f8ac8ce8112a34cf03f0ce
Catch InstanceNotFound exceptions for V2 API virtual interfaces

Use the common.get_instance method to get the instance object
in the V2 API virtual interfaces extension rather than call
the compute api directly. The utility function
handes InstanceNotFound exceptions and tranlsates them to HTTPNotFound
rather than letting them propagate up causing a traceback.

Co-Authored-By: Michael Still <mikal@stillhq.com>

Change-Id: I8abee22c53195926e3d2af1da9b14cd9d3608e63
Closes-Bug: 1270804
Catch InstanceNotFound exceptions for V2 API instance_actions

Use the common.get_instance method to get the instance object
in the V2 API instance_actions extension rather than call
the compute api directly. The utility function
handes InstanceNotFound exceptions and tranlsates them to HTTPNotFound
rather than letting them propagate up causing a traceback.

Co-Authored-By: Michael Still <mikal@stillhq.com>

Change-Id: I1e69fed0c7c0c611fcfd48abbd4b4e0b1c8b403f
Closes-Bug: 1271146
Describe addresses in ec2 api broken with neutron

It attempts to retrieve the fixed ip directly,
but it's not supported by neutron.

After the modification,
the instance uuid will be pulled without using get_fixed_ip().

Change-Id: Ia1b95d4c18aeb5012919af89148947694d80e2e7
Closes-Bug: #1273837
Fix the validation of flavor_extraspecs v2 API

"create flavor_extraspecs" v2 API does not validate the data type
of a request body. If invalid parameter is passed, an internal error
happens. If many invalid requests come, a log file would be occupied
with traceback.

In addition, it does not validate the lengths of both key and value of
extra_specs. extra_specs are stored into the instance_type_extra_specs
table, and the key and value are defined as String(255).

This patch fixes the validation code from the viewpoint of data type
and key/value length.

Closes-Bug: #1264220

Change-Id: I195bd5d45a896e9b26dd81dab1e49c9f939b4805
Fix the calls of webob exception classes

The webob exception classes has "explanation" arguments but some
methods calls the classes with invalid arguments. This patch fixes
them.
In addition, this patch changes the error handling of agent_build
_create() because the method raises AgentBuildExists exception only.
The API of v3 has already done it.

Change-Id: I2af5aae297c09ed34fadf6520f1a06228624a5a9
Fix HTTP methods for test_attach_interfaces

delete() method of attach_interfaces API is routed when specifying
"DELETE" as HTTP method, but some tests specify "POST". This bug
does not affect the test behaviors because the tests do not check
API router behaviors and just checks delete() method behaviors.

However, this patch fixes this bug because the bug confuses the
API router behaviors.

Change-Id: I8e862cbd58da820eb336d3ef41185e16f63bb6be
Fix logic for aggregate_metadata_get_by_host_with_key test case

After deleting a3 metadata, it is the host that once has such metadata
should be tested.

Change-Id: I79c40aa977911cd327d478ad8d9f147e19325017
Fix the explanations of HTTPNotFound response

Nova wsgi framework gets "explanation" from HTTPNotFound exception and
outputs it into a response body as "message" attribute. Now some error
explanations are passed to HTTPNotFound exception without explanation
argument and they are not output to a response body. As the result,
the default message "The resource could not be found." of wsgi library
are output to a response body instead.

This patch fixes them to output right message to a response body.

Change-Id: I80d3a2da6258e94c485ce024eb310a63bcf39773
Closes-Bug: #1285437
Fixes evacuate doesn't honor enable password conf for v3

The evacuate api should honor enable_instance_password conf
setting just like server creation, rebuild and rescue api does,
enables this flag will returning the instance password from
server API call evacuate, If the hypervisor does not support
password injection then the password returned will not be
correct, this patch just fixes v3 evacuate api, since change
return value of v2 could potentially break apps which depend
on this being returned.

This patch also changes the evacuate response code to 202 to
keep consistency with api.

DocImpact
Change-Id: I2b9e5a067323ca84e2040e175a0425de3c0fafba
Closes-Bug: #1244203