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
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
Rename Openstack to OpenStack

Change-Id: Iacc51d8ad071c3b22b7bb6b21cff972599b59a7b
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 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
Added os-security-groups prefix

Added os-security-groups prefix to the security_groups attribute in json response.

Change-Id: Id2a4a92da0c9751abc5c37f06fc2484ba80a8a09
Closes-Bug: #1223309
Fix log messages typos in rebuild_instance function

One log message typos in rebuild_instance function.

Change-Id: I0c86a40b6683f3a8a091134b6f37c82a4562370e
Closes-Bug: #1288661
Rescue API handle NotImplementedError

There are several nova virt drivers that don't implement the rescue API,
but the os compute API doesn't handle NotImplementedError,
it returns a 400 instead of a 501.

The patch add the proper logic to return a 501 instead.

Change-Id: Ia649c4dadd50985efed631ce8f3e4b212646766e
Closes-Bug: #1287367
Add conversion type to LOG.exception's string

Add conversion type for 'String Formatting Operations' to
LOG.exception's string in _get_floating_ips_by_fixed_and_port().

Change-Id: Iec97a354176e3044064bf190735257080be7ae70
Closes-Bug: #1289230
Fixup debug log statements in the nova compute manager

We were mishandling instance logging in a few places.

Change-Id: Ie1ec44fb5092ca9229e037328def52cb6aa81c33
VMware: delete vm snapshot after nova snapshot

When performing a nova snapshot, the vmware driver takes a VM snapshot
and copies out the snapshotted disk. After the operation, the VM
snapshot should be deleted, to prevent growing disk chain(s) on each nova
snapshot.

Closes-Bug: #1252967
Change-Id: I7861ccce0153e45eea0316a2e8dd824210db1660
Fix broken API os-migrations

The return is not what we are expecting:
  migration-list: 'unicode' object has no attribute 'iteritems'

The conversion of the object nova.objects.MigrationList into a list
is not applied automatically.

Change-Id: I1579b1baf62275bf448f23be9465d4e9bc11ed85
Closes-Bug: #1260249
Don't detach root device volume

Detach a root device volume may cause various guest error. Although
we can argue that it's user response to not detach the root device
volume, a check in nova will be more helpful.

We can either give a warning message, or not allow it. This patch
forbids this operation, considering that even in real system, remove
root device does not make much sense.

Closes-Bug: #1279300

DocImpact

Change-Id: I01f086be668b35442a2f139f4d7dc96884a3bda6
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Reverts change to default state_path

Reverting the change to the default value of state_path introduced by
I94502bcfac8b372271acd0dbc1710c0e3009b8e1 for the reasons set out
in my -1 review of the same that seems to have been skipped when the
change was accepted.

As implemented the change will break any existing systems that are using
the default value of state_path with no warning period, which goes beyond
the scope of change for UpgradeImpact

A better approach would be to introduce a new config value that is used in
the code, but is over-ridden by "state_path" if it is still in the config file,
and log a warning that state_path is deprecated and will be removed in the future.

That way the change to default behavior can be introduced at the start of the
next release cycle by removing the deprecated state_path config value, and
users have until then to prepare.

It does mean that we keep the insane default for a bit longer, but I think that's
much better that breaking a running system.

Closes-bug: #1291515

Change-Id: I7bb70c551ec9616276552d2e32076b66a1d3ce01
Fix docstring for shelve_offload_instance in compute manager

The shelve_offload_instance method in the compute manager is using an
instance object now but the docstring for the instance param said it was
a dict.

Change-Id: I9376f09402ac00e570a58f9b58b2f4aa56a7e16d
Delete meaningless lines in test_server_metadata.py

Some meaningless lines were found in test_server_metadata.py.
I deleted those.

Change-Id: I3f04bc0d4c9048281293ed78e4ba7ea4a2b26864
Make sure instance saves network_info when we go ACTIVE

This makes sure that when we do a save() on our instance during
creation, that we don't save the empty network_info we created
earlier over a potentially-full one built during the process.
This may happen since we wrap the networkinfo in the async helper.
This also moves the network_info.wait() out from under a conditional
which could cover up other issues leading to a case where it is
None (which shouldn't be possible). If we didn't call wait(),
then saving it wouldn't be productive or correct.

Change-Id: I9bd8dd0dce9e17cd128c7495acd52aa82119c57c
Related-bug: 1249065
Merge "Correct the state for PAUSED instances on reboot"