Don't return from a finally block

The code in the finally block always executes, even if an exception is
raised. If a return is done, that will cause exceptions to be silently
ignored.

Some unit tests have been failing because of API changes to the
nova.compute.manager:ComputeManager._delete_instance method but the
use of finally/return ended up silently ignoring that error and
caused the test to appear as if it was passing. Another unit test
fails because of a missing uuid attribute.

It could also potentially cause other exceptions to be ignored at
runtime (such as SystemExit) which is likely not the intended
behavior.

Change-Id: I083ee7215296e35a0027be5b3ddf8b764f44cc5b
Closes-bug: 1324277
Check if volume is bootable when creating an instance

Cinder provides a bootable flags for volumes that's not being
checked when creating an instance.

If a user select a non-bootable volume, then the VM became unusable
since nothing will be booted at all.

This check is done only in case that a volume is selected as root
device for a VM.  Boot from snapshot will still work (even that the
volume will be marked as non-bootable by cinder, but will boot the
attached snapshot instead)
If the attribute bootable is not present, we keep the old behaviour
and allow the instance creation.

Change-Id: I8e028d40d6a11beeac4f043afccb17eb61f6ce62
Closes-Bug: #1321334
Use no_timer_check with soft-qemu

The Linux kernel timer check not working properly
when the hypervisor's thread preempted by the host CPU scheduler.

The timer check is automatically disabled with other types
of hypervisors including the hardware accelerated kvm,
but timer_check is not disabled when qemu used without hardware acceleration.

This issue is frequently mischaracterized as an SSH connectivity issue and
causes rechecks and occasional boot failures.

This change adds no_timer_check kernel parameter when we are using
uec images with qemu.

Closes-Bug: #1312199
Change-Id: I3cfdfe9048fe219fc12cdac8a399b496f237e55e
Make SecurityGroupAPI use Object instead of instance_get_by_uuid()

This patch makes the SecurityGroupAPI use the SecurityGroup object
for querying the list of security group names instead of pulling
the instance by id, and then following the ['groups'] link.

This is part of a set aimed at deprecating the instance_get_by_uuid()
method on conductor.

Related to blueprint compute-manager-objects-juno

Change-Id: Id69c2019e934cef72c9b06caa503ea74f28720ce
libvirt: Use os_command_line when kernel_id is set

Patch Iad53c687053bdb5469baad4331ea55f428c170b0 breaks libvirt with
"-append only allowed with -kernel option" when using images without an
explicit boot kernel set because the -kernel option (kernel_id in nova)
isn't supplied for those image types.

This patch reads the os_command_line property from the image metadata
only when using images with an explicit boot kernel set and ignores it
otherwise.

Closes-bug: 1300861

Change-Id: I06c2d9930e0f36a0d7057b6a0f5c9c591caac43f
Treat instance objects like objects in set_admin_password flow

The set_admin_password API path uses instance objects but does a direct
database update in nova.compute.api and accesses fields on the object
like a dict.

This patch changes the code to update the database via the
Instance.save() method and accesses fields on the object using dot
notation.

Part of blueprint compute-manager-objects-juno

Change-Id: Iff82b19ba4ea007930d20d26a613687484392861
Remove unnecessary else block in compute manager set_admin_password

The else block is useless since the conditional block before it raises
an exception, so remove the else.

Change-Id: I1cd859a3f20b1ab9ab2502967526d306ebca9961
Don't translate debug level logs in nova.virt

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: I524b48f530d8afd59a067074332e3964426e4d70
Bump hacking to 0.9.x series

Hacking 0.9.0 had a minor bug so require 0.9.1 or higher.

In order to keep this patch to just a requirements bump, ignore new and
stricter hacking rules that are being triggered. Fixing up the code and
turning these on is out of scope of this patch and is for future patches.

Change-Id: Iafbd4adae8c6b446d53b62dfc490eab8e76a43ac
Fix H401,H402 violations and re-enable gating

H401 and H402 got stricter in hacking 0.9, so fix new violations and
re-enable gating.

Change-Id: I4785d14edee1ffdf32e2900f6e6234cbecab6d8a
Remove variability from object change detection unit test

Insure hashes of object representations are consistent by normalizing
data using sorted lists (as compared to dictionaries whose keys and
values are listed in an arbitrary, variable, dependent order:
https://docs.python.org/2/library/stdtypes.html#dict.items).

Closes-Bug: #1325246

Change-Id: I1344a820263683a024818d181ec6ee08e5e18984
xenapi: move find_vbd_by_number into volume utils

Above function is only used in volumeops, so moved to volume_utils.
Also added some unit tests to cover that function.

Change-Id: I1298dd35d8a41832475c6d6bd908af8f6576be82
Enabled swap disk to be resized when resizing instance.

When you resize an instance, it is powered off and the root and
ephemeral disks are resized (not swap). Swap is not resized
because it is a partition. To allow the swap disk to be resized,
we have to delete it and re-create it with the correct size.
We do not care about the contents of the swap disk because
when an instance is shut down, the contents of the swap space
are just garbage, the OS doesn't bother about what is in it.

Change-Id: I2bb05f01af6c97e6860dcd79a68884101a13c7d4
Closes-Bug: #1244222
Block device API missing translations for exceptions

Added translations to exceptions raised in the API.

Change-Id: I7b8ba03b735297fee04011c90fc3c6e6f9e27a0e
Merge "libvirt: Use os_command_line when kernel_id is set"
Fixes typo error in Nova

This submission is to fix the typo error
in "nova/network/linux_net.py" file.

Change-Id: I7219503085eb17a8517ab12c3d9703007f2bc54e
Fix the wrong dest of 'vlan' option and add new 'vlan_start' option

* Allow to specify vlan tag when create nova network, the dest of vlan
option should be 'vlan' instead of 'vlan_start'
* Provide new option 'vlan_start' when create nova network
* test case is updated.

DocImpact
Closes-Bug: #1288609
Change-Id: I8dd858e4cf17d8f689613554d1fbc3e56f220886
Merge "Don't translate debug level logs in nova.virt"
Merge "Make SecurityGroupAPI use Object instead of instance_get_by_uuid()"
Merge "Remove variability from object change detection unit test"