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
Fix inconsistent quota usage for security group

The quota usage for security group do not decrease when the security
group is deleted by admin. Fixes the issue by using the new quotas
object.

Change-Id: If82ee4edeca934c7be360e4129baa12b1c9a4da1
Closes-bug: 1260575
Do not add current tenant to private flavor access

Avoid adding the current tenant to the flavor access list when
a private flavor is created. In ordeir to add tenants to the
flavor access list we should use the add_tenant api.

Tempest has to be updated accordingly:
https://review.openstack.org/81551

Documentation has to be updated as well:
https://review.openstack.org/82175

Partially (just for the V2 API rather than V2 and V3)
reverts commit 6ba248635b70860a44e486e7739efa4cc6612ce6

Fixes unittest which was added in the original commit so it checks
for the behaviour we have now rather than the behaviour after the
backwards incompatible change which is being reverted.

Change-Id: I731081b6df0d96df1bc1763d214d28c62bbbb51c
Closes-Bug: #1286297
Imported Translations from Transifex

Change-Id: I8ae613b1f3d4166e329f7b844965e507b9121596
Re-work how debugger CLI opts are registered

CLI options must be registered before the command line is parsed or a
cfg.ArgsAlreadyParsedError is raised.

Since commit 2cbea24 we are registering two 'remote_debug' arguments
in nova.service. In commit b506529, we see a hack being added to
ensure that nova.service is imported and the CLI opts registered
before config.parse_args() is called.

To clean this up somewhat, refactor all the elements of this remote
debugger support into nova.debugger. Avoid importing modules at
module import time since we need to import this before monkey
patching. Add a function for registering the CLI options just before
config.parse_args() is called. And fail gracefully if the CLI options
aren't registered when we called debugger.init().

Note that because the options aren't registered at module import time
any more, the config generator doesn't pick them up. However, that's
actually a good thing since this support doesn't work if you enable it
via config files since debugger.enabled() only looks at the command
line.

DocImpact: remote_debug options are not available via the config file,
only via the command line.

Change-Id: I97f747a2fb9222137203657df1d86ba89f3219e2
Change libvirt close callback to use green thread

The native thread that calls the close callback is being
used to update a host's status, potentially causing threading
issues, since it involves operations that should only be
performed by green threads. This change fixes the issue
by limiting the native thread's interaction to adding data
to a queue and leaving the remaining work for
a green thread.

Closes-Bug: #1290487
Closes-Bug: #1293641

Change-Id: I59c14da15e4655dc4bf21d4de3d509472b146f7a
Updated Setting up Developer Environment for Ubuntu

I saw that there are a few libraries which are required but not
mentioned in the docs.

Change-Id: I47036bb85c1b4c617f14d7534c204df474439513
Fix availability-zone option miss when creates an instance

In test_availability_zone.py the availability-zone option is
used as 'availability_zone' which should be modified to
'os-availability-zone:availability_zone'.

Change-Id: I765d07b699ecb425dadccb22af834b11f52ff5b0
Closes-Bug: #1270811
Don't attempt to fill faults for instance_list if FlavorNotFound

When getting a list of servers with details, if a FlavorNotFound is
raised from the compute API the local instance_list variable is set to
an empty list, but later instance_list.fill_faults() is called on it
assuming it is an InstanceList object, which will cause an
AttributeError.

This patch just checks to see if instance_list is empty before calling
fill_faults since InstanceList.fill_faults assumes the list is not empty
when called, so it's not trivial to simply create an empty InstanceList
here and set it to the instance_list variable.

The new test cases use testtools.matchers.HasLength and while seeing
if testtools was imported I noticed it (along with mox) was in the
wrong import group, so also fixed the order there.

This patch also fixes the test_get_server_details_empty unit test to
actually call the detail method rather than index.

Closes-Bug: #1296940

Change-Id: I9f85c2a0b70f41e5bba2da05a2339caf2a8efc3e
Tell pip to install packages it sees globally

Use pip's option to force installation of packages so that
local copies are installed in the virtualenv, even if they
are present in the global site-packages directory. This
ensures that the latest packages are installed, and that
all of the oslo libraries from namespace packages are
installed in a consistent way, making it possible to run
unit tests on a system where devstack was run previously.

Change-Id: If5c4e12956f2c7be6530c5c9a57fdfb1da8e710c
fix the extension of README in etc/nova

the file is a text file, not a conf file, this change prevents
accidental parsing (and erroring) when setting config_dir=etc/nova

Change-Id: I35c35e812736908858aad235fb173beaf74f74bb
Merge "Tell pip to install packages it sees globally"
Merge "Imported Translations from Transifex"
Merge "fix the extension of README in etc/nova"
Merge "Do not add current tenant to private flavor access"
Merge "Change libvirt close callback to use green thread"
Merge "Fix availability-zone option miss when creates an instance"
Use correct project/user id in conductor.manager

The project/user id of the user is not passed to the quotas.rollback
methods in conductor/manager.py if the instance is migrated by admin.
This fixes the issue by using the new quotas object to ensure the
right project/user id.

Change-Id: Ifdcfb62ed7eb0710bfdd921b0213be240a00345c
Closes-bug: 1296502
Merge "Updated Setting up Developer Environment for Ubuntu"