Remove unnecessary passing of task_state to check_instance_state

Remove cases where task_state=[None] was passed to check_instance_state
when that is essentially the default value anyway

Change-Id: I49b6449b9ae43a5cfcf5a1ccac5ee9a64d2b3f3c
Update block_device_info to contain swap and ephemeral disks

An ephemeral or swap disk is attached to an instance on boot
as follows: nova boot --flavor FLAVOR --image IMAGE_ID
--swap 512 --ephemeral size=2 INSTANCE.  When a hard reboot is
performed on the instance, nova fails to recreate the
appropriate libvirt XML definition, containing the ephemeral
disk.  This is because the correct block_device_info dict that
is passed to the compute manager's reboot_instance method does
not contain swap or ephemeral disk key values that are necessary
to recreate those disks.  In addition to nova boot, the correct
block_device_info dict is also needed by nova rebuild, reboot,
resize, and migrate to recreate those disks.  This patch updates
_get_instance_volume_block_device_info (renamed
_get_instance_block_device_info) to return the swap and ephemeral
disk key values, in addition to the block_device_mapping it
already returns today.

Change-Id: Iec329d1c12a48ea90ba9d57decd0996fde6544f0
Closes-Bug: #1305423
Add fault wrapper for rescue function

we might need to record the unsuccessful action for instance,
rescue function currently don't have this method. This patch add
it so that it will record failed rescue action into db.

Change-Id: I615089e7562262dc286a55a2c7228be3201d6d94
objects: remove unused utils module

The nova.objects.utils module appears unused since commit 91a89f4 when
we finished refactoring the code into nova.objects.fields.

Change-Id: I1468172f823e362eca7f152ba282982fb5b41f35
Make live_migration use instance objects

Since live_migration moved to the task API, we've been passing
instance objects down to compute/rpcapi, but then converting them
to primitives at that point. This removes that, enables compatibility
with older code, and makes the live_migration() use objects.

Note that live_migration() is different from all the other calls
we use the object_compat decorator on, since instance is not the
first parameter. Because of this, and because it's called from a
single place where we know what expected attributes we should have,
this just adds the compatibility code directly into the method,
instead of trying to complicate the decorator for this one-off
case.

Related to blueprint compute-manager-objects-juno

Change-Id: Ibbad57569c67db6ddc2e6cc41ea49f77c46d761e
Don't translate debug level logs in nova.compute

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Continuation of Ie1068d2d2c7c37f27c62d0e4e5a64a1a504af9f5

Change-Id: Id6ed926df97fe31b4d553546818de5356e3a4cbb
Don't translate debug level logs in nova.objects

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: I8bdc66c0711539b373884dc35a84ee8143e6de67
Don't translate debug level logs in nova.cmd and nova.db

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: I8fa50e469384f4b626ae6aa47e9ca0b8e29da404
Don't translate debug level logs in nova.cert, console and consoleauth

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: I9a0c718fc71e456baf87d1d28827654a015c62a6
Don't translate debug level logs in cloudpipe, hacking, ipv6, keymgr

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: Icdae100d5a506fdaa56fd124dc9860cdfddbe288
Don't translate debug level logs in objectstore, pci, rdp, servicegroup

Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: I4c8e7365e1e3bae52956249f1c7d97c7729aebc3
Raise descriptive error for over volume quota

If you attempt to create a new instance booting from an image and you
were over your quota on cinder, the nova manager would see that as an
invalid block device. This raises a more descriptive error message in
the logs.

Closes-bug: #1013417
Change-Id: Ie50b97c31580da7fc38c6891d1f3646b91f8aa10
libvirt: Stub O_DIRECT in test if not supported

`os.O_DIRECT` is only defined on platforms that support direct I/O. On
Macs, which don't support direct I/O in this way, `os.O_DIRECT` will
raise an `AttributeError`.

We can still test the code-path, however, by just stubbing out the
value on platforms where it's not supported.

Closes-Bug: 1286958

Change-Id: I8f10d6dfc4a63b6a961006b029b828e703870e46
Include pending task in log message on skip sync_power_state

To better understand why sync_power_state is being skipped include the
pending task name in the log message.

Change-Id: I832a3d5820efab301e12610b28ca2a1e5cfd946a
Remove duplicated import in unit test

A couple of unit tests were importing twice mock or mox.
This patch just remove the duplicated import.

Change-Id: I0c66746348e184a3846cadd40d7d7cbb7d594564
VMware: reduce unit test times

A number of tests would take longer than a second.

Closes-bug: #1315870

Change-Id: I4d5c9fac460278135ab1c2c7876f3ac6e6f3d4a6
Fix calls to mock.assert_not_called()

There is no assert_not_called() method in mock, as described here:

https://code.google.com/p/mock/issues/detail?id=159

Fix these calls to use the mock.called attribute instead.

Closes-Bug: #1316167

Change-Id: I865463244ebfc45e1f940c74e1afbb9084930bb3
Improve hacking rule to avoid author markers

The case with the tag "moduleauthor" is not handled when
checking to avoid author makers.
Also fix the position when the tag Author is used.

Change-Id: I17b07b9f5448f9cbb4c5705f655c5392316a6239
Closes-Bug: #1314176
Raise HTTPForbidden from os-floating-ips API rather than 404

The os-floating-ips extension was catching and handling a 404
and 403 in the same block and raising HTTPNotFound for both.

This change separates the 404 and 403 cases so HTTPForbidden
is returned in the 403 case.  For the 404 case, the test is
updated to raise the proper NovaException and a new test is
added for the 403 Forbidden case.

Change-Id: Id0daf2d61c6960d845d3b7980f96228fece41128
Merge "Don't translate debug level logs in nova.compute"