handle auto assigned flag on allocate floating ip

Set auto_assigned field to the right value on allocating floating ip to
avoid potential race condition in nova-network.

fix bug 1190585

Change-Id: I8ee34924439d2a29b1b5a966b92856e63cc1afdc
Clean destroy for project quota

    * Destroy user quotas under the project when deleting project quota.
    * Fixes bug 1206479

Change-Id: Id8391a2f6c25974b990c4a95a6bc99d696cd1c98
VlanManager creates superfluous quota reservations

The VlanManager does not enforce quotas on fixed IPs because it
allocates an entire network to a project. However the process
of deallocating an IP address still creates an entry in the
reservations table.

The VlanManager now loads the NoopQuotaDriver and no longer
writes superflously to the database.

Change-Id: Idf95085a5c1f4e71f3f0fc92618607073602eed3
Fixes: Bug #1204714
Don't inject files while resizing instance

Fixes bug 1208680

As what the code owner of method 'finish_migration' in libvirt driver
said, the files injecting operation is not necessary during resize,
because they have already been injected when creating the instance,
so added a parameter to _create_image to fix this issue, which is used
for identifying the injection is needed or not.

Change-Id: I01990de0ad2c7f1c2e499144034b7a4ac9faf024
Add an exception when doesn't have permissions to operate vm on hyper-v

This commit adds a wrapper checking method when creating/operating
vms on hyper-v, it will raise a HyperVAuthorizationException if the
windows account running nova-compute on this Hyper-V host doesn't
have the required permissions to create/operate the virtual machine.

Fixes bug #1195205

Change-Id: I2ef67a686c99dc83fcc3e9f47a71473929b01e9f
Fix FK violation in ConsoleTestCase

setUp() of ConsoleTestCase creates a few Console instances
that reference a non-existing instance with generated UUID
value. The tests work great on SQLite (because FKs are disabled),
but fail on MySQL and PostgreSQL.

Blueprint: db-api-tests-on-all-backends

Change-Id: I2417b6f6dad8c9c84af8b49a3c6db8b9bb715e56
Have tox install via setup.py develop

tox 1.6 was released, which means that we can now take advantage of the
feature we added to it - which is using setup.py develop to install the
code into the virtualenv. The logic was taken from run_tests.sh - so the
performance issues around using tox vs. using install_venv should now be
gone.

run_tests.sh is still needed to handle the ui switching between
parallel, single and debug modes to testr.

Change-Id: Ida5e440d1bdb9f8e9031277ea53a02d2ef171438
baremetal: Log IPMI power on/off timeouts

Added log messages for cloud operators so that they can tell when an
attempt to turn a device on or off via IPMI has failed after the
configured number of attempts.

This should help operators diagnose issues on devices that respond
slowly to IPMI commands.  The failure to repeatedly change the device
power state is now logged precisely along with the cause, where
before operators had to diagnose the issue through trace log captures.

Partial-Bug: #1177584
Change-Id: Iecd6fadb2b653f4ccbe75882c2ef85812b334e8d
Add flag to make IsolatedHostsFilter less restrictive

This patch allows to run 'isolated' and 'non isolated'
images on isolated hosts by adding a flag
'restrict_isolated_hosts_to_isolated_images'.

If the flag is set to True then 'non isolated' images
can't be run on isolated hosts (same behaviour as the
current filter) otherwise they can be run on isolated
hosts.

DocImpact

blueprint improve-isolatedhostsfilter

Change-Id: I8c092caf32c05be88a547a7e8cb0530cc4925080
Port flavormanage extension to v3 API part 1

This is part 1 of the two part commit to port migrations to v3.
As part of this commit the api and test files are copied over to v3
plugins folder. The second changeset will have changes to port
migrations to v3.

Partially implements blueprint nova-v3-api

Change-Id: I2a51185f557c68022a2f3aaa006acb1e89b3c737
emit warning while running flake8 without virtual env

run_tests.sh -N -p
it will call the flake8 installed on your host to detect PEP8, and
the flake8 plugin "OpenStack hacking" may not installed on your
host, so this command may not detect the OpenStack Style Commandment
supplied by hacking(e.g H202).

run_tests.sh -p
it will call the flake8 from virtual env, flake8 plugin "OpenStack
hacking" installed in virtual env will be triggered.

The result from "run_tests.sh -p" should be trusted, and jenkins uses
virtual env to run flake8 too.

When "-N" is enabled, emit warning to remind user.

Bug #1215404

Change-Id: Ie503fa34e6a3cf7b1f52f0b53019ddea188dabff
Delete expired instance console auth tokens

Instance console auth tokens never get deleted from the cache
before the instnace is deleted, this is a waste of memory. now
we check if tokens are expired then remove them from the cache
before store new tokens.

Fix bug #1209134

Co-authored-by: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: I8dd5089ebaed3b3d91932f1f1558bbe302cd5675
Fix unicode key of azcache can't be stored to memcache

The memcache library we are using assumes all strings passed to
it are plain ascii, so we need to convert unicode to string.

Fix bug #1212164

Change-Id: Ibf36e6b096893cb9f056371bb43cbb441cae6e32
Add alias as prefix to request params for user_data v3

fix bug 1215710

DocImpact

Change-Id: Iae48d2caefb1de46698c57712eae357c70c78997
VMware: clean up get_network_with_the_name

By default the method returns None. No need to do this explicitly.

Change-Id: Ie18300bdfaaec8d9c813352fe42a2aebec730c45
Powervm driver now logs ssh stderr to warning

The run_vios_command, run_vios_command_as_root methods in
blockdevice.py and operator.py of powervm driver currently log
stderr at debug level, this commit changed it to log to warning
level rather than debug.

Closes-Bug: #1215019
Change-Id: I903067476049ead01c6c34392342d915917790b3
compute rpcapi 2.29 is not backwards compatible

patch 6fcf4133b49cfefa77151937dec4db097a85c349 which added compute
rpcapi version 2.29 does not provide any backwards compatibility.

Fix this issue with 'self.can_send_version'

Fix bug 1217068

Change-Id: Idc49040b712058aab8d3ed769bdf18bdc0a4f067
Fix network creation in Vlan mode

- If "vlan" is specified when creating a network, we honour the option.
- If it is not specified, the Vlan number is calculated as follows:
CONF.vlan_start + num_existing_networks + index_of_requested_network
- If the above vlan is in use, try to get the next free vlan.

Fixes bug 1194835
Fixes bug 1169026

Change-Id: Id4476c14f9dadcf498a499534337477b3f64f604
Adds V3 API samples for migrations

Partially implements blueprint v3-api-unittests

DocImpact

Change-Id: Ic1a1b96f00831b22c9499d3ac2953f3d08819905
Adds API version discovery support for V3

Adds version information for the V3 API which is only displayed
when the V3 API is enabled. Even if the the V3 API is enabled the
V3 API status is "EXPERIMENTAL" and the V2 one "CURRENT". This was
done so autodiscovery tools would not yet use the V3 version by
default.

Ports the relevant parts of the version extension and associated
tests to the V3 API to display V3 version information for /v3 GET
requests.

DocImpact

Partially implements blueprint nova-v3-api

Change-Id: Idd335ce0df63d91e94a4a757f1fbae94b576c37e