baremetal: Add missing method to volume driver

Added get_hypervisor_version(), which is called by underlying
LibvirtVolumeDrivers. Also added tests roughly checking if the
underlying drivers can be loaded and be called without error.

Partial-Bug: #1208707
Change-Id: Ida6b6800d1ef518c6e76d6b2ab4ac2f795a744ca
Make scheduler disk_filter take swap into account

The disk_filter, which makes sure a node has enough disk space for an
instance doesn't take the swap partition into account, but swap takes up
disk space so it should.

Change-Id: I0779dcf0f1cd60017b5b49ca38c0a15b23d802d7
Closes-Bug: #1239009
Add V3 API sample for admin-password

Adds api sample tests and api samples for admin-password

Partially implements blueprint v3-api-unittests

Change-Id: Iade39ff931471d1d68e358ac5d35a1921e85df66
Adding support for multiple hypervisor versions

This is to prevent instances with newer tools from being provisioned
on older hypervisors.
Added comparison of hypervisor version from the compute-node and image
metadata in the image properties filter.
In host scheduler image_prop_filter, the 'hypervisor_version_requires'
image properties, if available, is compared to the host_state's
hypervisor_version, if available.
hypervisor_version_requires should be added on the image as metadata and
should have a operator and version value.
Examples : ">=6.0", ">6.0, <6.2", ""!=6.1"

Partially Implements blueprint xen-support-for-hypervisor-versions
Cell scheduler changes coming up in another commit.
DocImpact

Change-Id: I6fbf232adf9ac78ebb8ac2985739f163f4517d14
Fix the ConsolesController class doc string

The code must have been copied from the console output extension to start
with and the old class doc string was left in place.

Change-Id: I4924e69763027043aace8e34aac55701be2ea823
Closes-bug: #1241685
Fix all scripts to honor the enabled_ssl_apis flag

Add logic to allow configuration of SSL for all the cmd scripts
that start a WSGIService

Change-Id: I921013d113081a91a3fe9bb574bae5cd7bb06bcc
Closes-Bug: 1237126
Fix wrong description when updating quotas

when updating quota for a resource, with 'force_update=false', an
exception will be raised when the new value is less than the used quota
values(used and reserved). This patch changes the description of
exception.

Change-Id: Iede70444341817afb6953eb604fe4de186622916
Closes-bug: #1243062
Refactor unit tests code for python3 compatability

The builtin basestring abstract type was removed in python3,
use str instead, we need to using six.string_types to replace
the basestring for py3 compatibility.

Partial Implements bp basestring-py3-compatible

Change-Id: I0f6a0f9ca4e17800407f3c1bbdce11a46288f693
Add flavor-manage to core for V3 API

Adds the flavor-manage plugin to the core list for the V3 API.
This is part of the process of adding all of the flavor related
extensions to core, with the exception of rxtx, as per the discussion
here: https://etherpad.openstack.org/p/NovaV3APICore

Partially implements blueprint nova-v3-api

DocImpact

Change-Id: Idbedce5cc5936abc52235cd40573c8fe841f24fe
Fix bad typo in cloudpipe.py

Looks like a refactoring problem. we should be raising
exc.HTTPBadRequest where exc is in webob.

Change-Id: Id6d4e1d43f1d49c05d9da1234e40a603022d35c2
Remove multipath mapping device descriptor

When detaching a volume from a instance, we need to remove
multipath mapping device descriptor if there are other volumes
mapping to the host instead of do nothing, for some cinder drivers
can not terminate connection for multipath tool sending IOs to
storage array periodically.

Closes-bug: #1223975
Change-Id: I6fc02e045146ece49162ca6be1a83fa8d0214a0a
Adds XML namespace example for disk config extension

Adds XML namespace and specifying of the disk config value
to the disk config extensions api sample test data for server
creation. This is being done so the api samples used by the
documentation contain the example of this usage.

DocImpact

Change-Id: Icd7aa3743f71dd1cb8575605e5f1ce5da6bd37bf
Closes-Bug: 1189817
Add nova.db.migration.db_initial_version()

Updates Nova to use a new function called db_initial_version()
instead of the INIT_VERSION constant. This allows us to
move the top level INIT_VERSION = 132 into the
sqlalchemy migration.py implementation where it belongs.

Also, includes changes to do the same for the Nova
baremetal migrations.

Change-Id: I10dacdebb50d3121e3bfd094e40138807233aa64
Bad except clauses order causes wrong text in http response

InstanceInvalidState is an ancestor class of InstanceIsLocked, so
we need to catch InstanceIsLocked first. Fix the test case to
ensure we get the right http response back

Change-Id: Id22b284d9b7da8db4161ad8703bea1702cb0b82e
Stored metrics into compute_nodes as a json dictionary

The compute manager uses plugins to get the metrics information of each node.
And then sends and stores in DB for the scheduler to read and do scheduling.

The patch reuses table compute_nodes and adds a new TEXT column to store the
metric data as a json dictionary.

This is part of the blueprint utilization-aware-scheduling and the
blueprint generic-host-state-for-scheduler.

Change-Id: I4d20565567e9907cfcc92b1c1b15f3b35a806797
Signed-off-by: Shane Wang <shane.wang@intel.com>
Fix power manager hangs while executing ipmitool

In nova/virt/baremetal, IPMI power manager uses ipmitool with '-F' option to
specify a file containing the remote server password.  When the passowrd was
empty, ipmitool ignores that file and asks user to set password in stdin.
This makes the thread stop.

This patch changes power manager to write '\0' to the password file in the
case of empty password, to force the password on impitool.

Closes-bug: #1237802

Change-Id: I44f56129a8ce2af4dda8dea35eb9c60d9518d54b
Pull system_metadata for notifications on instance.save()

When saving changes on an instance object a notification is sent out.
An attempt is made to pull flavor information from the instance but if
system_metadata is not joined then an exception is raised and the
notification fails.  This ensures that system_metadata is available for
those notifications.

Change-Id: Ifd317f847c3839cd6019038bb3dc856b9f107000
Closes-bug: 1244311
Fix tests to work with mysql+postgres concurrently

Optimise tests.db.test_migrations and tests.db.test_migration_utils for
concurrency and make opportunistic tests obey walk_style configurations.

Closes-Bug: 1207750

Change-Id: Idb30f144fb67aefc58749897d774103c3c0ec640
Remove fake_vm_ref from test_vmwareapi.py

This fake method is useless now, we can remove it for now.

Change-Id: Idcef18f1e89cac30b1481580731a4f61b0f22050
Nova-all: Replace basestring by six for python3 compatability

The builtin basestring abstract type was removed in python3,
use str instead, we need to using six.string_types to replace
the basestring for py3 compatibility.

Partial Implements bp: basestring-py3-compatible

Change-Id: I17e87e49e7ebf3cc9c391e9beace8c45d2d2b689