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
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
Implement Quantum support for addition and removal of fixed IPs

Fixes bug 1099378

Change-Id: I696d1f702cf99ef15af47c261844febd8a6e7ffc
Fix nova.availability_zones docstring

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

Change-Id: I2aa0e63a7e9c3b7bea829fddf42a00d3318c6d6f
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
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
enforce server_id can only be uuid or int

the get() function takes an arbitrary id coming from the rest url
for the server. In our current code it checks if this is a proper uuid
and sends it down the uuid path, everything else gets dispatched to
the version that selects by integer id. This means that arbitrary
garbage fuzzed server ids will get sent down the int path, all the way
to the database.

In postgresql, where the db is strongly typed, this causes a type error.
This error was found by tempest nightly runs where we send some 35 and 37
character strings in.

This patch creates and equivalent is_int_like function. If the server_id
is neither uuid_like nor int_like, we throw the InstanceNotFound exception
early. This also saves us a trip to the database in these cases.

Make the is_int_like a little more robust, and don't succeed on floats

Once more with feeling, to let us actually use is_int_like on ints, not
just strings.

Fixes bug #1100253

Change-Id: If4ae8005fd33a23ac50a6408ecd5933a2ff6425c
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
libvirt: Optimize test_connection and capabilities

The getCapabilities call can be very slow so it is not a good choice
for testing the libvirt connection. This patch switches to
getLibVersion and also caches the result of getCapabilities so it
doesn't need to be requested every time. Note that this means that
nova-compute will need to be restarted if the capaabilities of the
host changes. This is an acceptable risk because capabilities
changes should be very rare and nova-compute should be restarted
if libvirt is restarted or reinstalled.

This simple change lowers boot time in my devstack install from
22 seconds down to 8 seconds!

Fixes bug 1100446

Change-Id: I1b5072a906b19c6130957cf255e8d35b20990828
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