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
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
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
Create ports in quantum matching hypervisor MAC addresses.

When hypervisors supply a set of MAC addresses for instances, the
network driver is responsible for matching up the requested MACs and
the available (or requested) networks.

The simplest case, which this patch addresses, is to create ports in
quantum on the desired networks, rather than having quantum create
them dynamically with dynamically created MAC addresses.

Change-Id: I84cd96671b76b8beaa31436c8a438f7818ef622f
Save password set through xen agent.

The get-password extension expects an encrypted b64 encoded password.
If we are setting the password via a guest agent and the user has
provided a public key, then we can go ahead and encrypt the password
and write it to metadata. If the guest agent is not working or not
installed, we leave the encrypted password to be set by posting to the
metadata server.

Related to blueprint get-password

Change-Id: I3ed26c7e1929f3c4c84f9bb87b0c620ab27223cb
Correcting improper use of the word 'an'.

Change-Id: I032509539c61f2f5fda2001e2db5a3298e30c561
correcting for proper use of the word 'an'.

Change-Id: Ib6180284d806a00c520df378e651fba947e2397a
Makes sure compute doesn't crash on failed resume.

If the call to the driver to resume an instance raises an exception,
then nova-compute fails to start properly. This can happen during
recovery, for example, where an instance has been deleted so the
backing files are gone but the database is restored to a state
where it exists.

This patch fixes the issue by catching the exception and setting
the instance to error.

Fixes bug 1100430

Change-Id: Ie31f39fcd43174c29bf7a5cb1b6fa29e4c723f97
Allow nova to use insecure cinderclient.

Add an option cinder_api_insecure to pass on to cinderclient.

Bug 1100459

Change-Id: Ifb31cc0df48d2345fa0a6ec440bdf9685254cbcd
don't allow crs in the code

triggered by this slipping into quantum, now that we have more windows
developers we should ensure that \r\n doesn't land in the code as
a line ending. This check prevents it.

Change-Id: I0a82be0e74915d3c3c25203db110d279580c148b
Remove network_host config option

It appears to be unused since 9c0ffe7 and was related to the
stub_network option which itself was removed in 3313cff.

Change-Id: Ic555e3523a90c83c6a89f24619252099c4e55f37
Use common rootwrap from oslo-incubator

Make Nova use common rootwrap code from oslo-incubator.
Implements bp nova-common-rootwrap

Change-Id: I3282d65940375589fceb8485829097380d84d946
PXE driver should not accept empty kernel UUID.

Baremetal PXE driver was aborting only if the kernel and ramdisk
specified in image metadata were None, but not if they were another
non-true value, such as "". Now, exception is raised if they are any
non-true value.

Fix bug 1100589.

Change-Id: I9783a14cc242e1b9db04d797c61d54b06d52c680