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
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
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
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
Merge "Make nova-api logs more useful"
Merge "sync latest log and lockutils from oslo"
Merge "Fix nova.availability_zones docstring"
Merge "libvirt: Optimize test_connection and capabilities"
Merge "enforce server_id can only be uuid or int"
Merge "Validated device_name value in block device map"
Merge "Clean up get_instance_id_by_floating_address"
Merge "Reduce number of iptable-save restore loops"
Merge "Create ports in quantum matching hypervisor MAC addresses."
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>
Do not merge: Direct DB access CLI for bare metal node management.

This is to be replaced by an API in trunk, is only kept to let folk
migrate incrementally.

Change-Id: Ibad39862225ac8bd5ab88c923838eb528418876e