Refactor work with TaskLog in sqlalchemy.api

Add _task_log_get_query() private method
It is used to remove from task_log_get() and task_log_get_all() session.
parametr and save performance.

task_log_get() method
Remove session parameter from public method.

task_log_get_all() method
Remove session parameter from public method.

task_log_begin_task()
Remove session parameter from public method.
Remove unused return value.

task_log_end_task()
Remove session parameter from public method.
Use 1 db request instead of 2.
Remove unused return value.

blueprint db-session-cleanup

Change-Id: I2c8252de7978e8fddd800e903f18a73ee9a95034
Remove baremetal-compute-pxe.filters

The baremetal PXE driver doesn't seem to run dnsmasq at all, so remove
the rootwrap filter which allows it to do so. This was introduced by
commit a2f260f.

Change-Id: I4cc1127222b73af218a6a8808d0ad54478878af1
Fix double reboot issue during soft reboot

Using the ID of domain in Libvirt to recognize the hard reboot has been
implemented or not, if the ID changed, we believe the domain has been rebooted,
return True and break from soft reboot.

Fixes: bug #1046356

Change-Id: Iec2f9e8225cfe2779f84d2095667f3c0e621e935
don't clear the database dicts in the tearDown method

This is superfluous as the two dicts (self.engines and
self.test_databases) are re-initialised during setUp anyway and aren't
used in between

Change-Id: Icafa9bdf3b0193f31752e6104ecac0e49476c812
Map libvirt error to InstanceNotFound in get_instance_disk_info

When getting instance disk info, the instance may be destroyed/deleted, and a
libvirtError will be raised in XMLDesc method, so catching and mapping it to
InstanceNotFound and the caller can handle it correctly.

Fixes bug #1064581

Change-Id: I07fed3e82e10dad4cb84ae5c8650ada351c24e78
Validated device_name value in block device map

1. Checked value of device_name parameter provided in block device
mapping section of Create server API.
2. Added unit test coverage.

Fixes LP: #1087165

Change-Id: I32ed59a577167d9bf42cb3667bfb1ba3963d6c71
Tests for PXE bare-metal provisioning helper server.

a part of blueprint general-bare-metal-provisioning-framework.

The deploy helper was landed without tests. This patch reinstates the
tests.

Change-Id: I690ec077e175dc37c2cc5f18170513b0e5bca103
Co-authored-by: Mikyung Kang <mkkang@isi.edu>
Co-authored-by: David Kang <dkang@isi.edu>
Co-authored-by: Ken Igarashi <igarashik@nttdocomo.co.jp>
Co-authored-by: Arata Notsu <notsu@virtualtech.jp>
Co-authored-by: Devananda van der Veen <devananda.vdv@gmail.com>
Fix state sync logic related to the PAUSED VM state

A VM may get into the paused state not only because the user request
via API calls, but also due to (temporary) external instrumentations.
Before the virt layer can reliably report the reason, we simply ignore
the state discrepancy. In many cases, the VM state will go back to
running after the external instrumentation is done.

Fix bug 1097806.

Change-Id: I8edef45d60fa79d6ddebf7d0438042a7b3986b55
Add Compute API validations for block device map

This patch adds validations to return 400 BadRequest to
Create server(s) with block device mappings where appropriate
and related unit tests

Fixes bug 1094244

Change-Id: I778d3ed4b0871561774594e950ce98b6a1ecfcb9
Implement Quantum support for addition and removal of fixed IPs

Fixes bug 1099378

Change-Id: I696d1f702cf99ef15af47c261844febd8a6e7ffc
use postgresql INET datatype for storing IPs

Change-Id: I9a61ffbececc6534b1a9c52e1fa29370db0e12ca
Fix nova.availability_zones docstring

Change-Id: I66fe5cd5ab688bd4d3bedcdb79823497c65912e9
sync latest log and lockutils from oslo

Change-Id: I2aa0e63a7e9c3b7bea829fddf42a00d3318c6d6f
enable hacking.py self tests

pep8 and hacking.py (by inheritance) have the ability to run self
tests via docstrings, if we format the comments correctly, and change
the docstring test regex. Include self testing in our normal pep8
tests.

fix the comments to actually be test case compliant

fix nova_import_alphabetical to pass on short import lists (only 2
lines, starting at the beginning of a file)

comment where it doesn't appear that hacking.py tests are working
(though there could be deeper black magic in some of them).

fix a doc string in pep8 self tests that breaks N301

fix the fact that pep8 error strings are supposed to start with
\w\d\d\d, we were just lucking out on some formatting because the
string NOVA happened to be only 4 chars long.

Add a couple of escapes so that we don't recursively fail on our
own fail self tests for comments. (boy that's fun)

Change-Id: I14d5e04cfc092b37ec4967cd7485e9975a5eb820
enables admin to view instance fault "details"

Change-Id: Ia29d265f9f73c2a6dcf36decc635383cc94bec35
Fixes: bug #1096278
Use testrepository setuptools support.

The previous false-positive bug was fixed upstream in 0.0.13.

Change-Id: Iceb07a511992249c104bbc7c34b7c35e01bd9fbd
Move migration_get_..._by_host_and_node to conductor

This moves the remaining migration-related database call out of the
resource tracker to conductor:

  migration_get_in_progress_by_host_and_node()

Related to blueprint no-db-compute

Change-Id: I9bdf9fbbc3131964bf6078d19bf1cd9053a7e224
Clean up get_instance_id_by_floating_address

Reduce number of nova.db calls in get_instance_id_by_floating_address
to 1, fixed_ip_get_by_floating_address (A new nova.db.api function)

Change-Id: Ie1313ea73290ae11dce03d3726d5c23e4d73cb00
Reduce number of iptable-save restore loops

Instead of running iptables-save and iptables-restore per table,
run iptables save and restore on all tables at once.

Change-Id: If610d07c22ddaeb03ab37ee64d3d3a55d5e5b34f
Make nova-api logs more useful

The current logs make it hard to identify what API command is actually
being called, especially for POST, where the action is in the body.

* Whenever there is body, log it (info level)
* Log what function the API command maps to (debug level)

Change-Id: Ief14186b94e321d97575ee25e3507d3fc0178de6