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
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
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
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>
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
Remove fake_vm_ref from test_vmwareapi.py

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

Change-Id: Idcef18f1e89cac30b1481580731a4f61b0f22050
Remove instance_type* proxy methods from nova.db.api

There were several proxy methods left in nova.db.api to ease the rename
of instance_type to flavor with a note to remove them later.  This
patch does that removal and handles the impacts to the tests.

Part of blueprint flavor-instance-type-dedup

Change-Id: I2dd7a68ea028056996da6ea96a1fe3cae4ad0389
Update schema_diff.py to use 'postgresql' URLs.

This gets rid of a SQLAlchemy deprecation warning when using this tool w/
PostgreSQL:

The SQLAlchemy PostgreSQL dialect has been renamed from 'postgres' to
'postgresql'. The new URL format is
postgresql[+driver]://<user>:<pass>@<host>/<dbname>

This appears to have been deprecated in the SQLAlchemy 0.6 series so I think we
are Okay to remove it now.

Change-Id: If8fdf822ba452b387e9f2f3ec7c9157e4ae932f9
Add a metadata type validation when creating vm

If specifying non-dict data(string, etc.) as metadata, "create a vm"
API returns a HTTP500(Internal Server Error) response because it does
not validate the metadata type.

This patch adds the metadata type validation, and the API will return
a HTTP400(Bad Request) response. In addition, this patch removes log.WARNs
of bad incoming requests because they are just client-side problems not
server-side.

Closes-Bug: 1238344
Change-Id: I8f1d5debf74891e67b17f8128cc0eb0ab7f5c3f5
Remove useless variable from libvirt/driver.py

There are some variables in libvirt/driver.py were never used, so
we can just remove them.

Change-Id: Ie29bfbeef8c185697aa94a6e05e67a70436302c8
xenapi: refactor get_all_vdis_in_sr

Making the code in vm_utils._get_all_vdis_in_sr more consistent with the
code in session.get_all_refs_and_recs.

Rather than catching all exceptions, the session.get_rec explicitly
catches the INVALID_HANDLE exception that xenapi might raise.

Change-Id: Ic69735e1a6caa893f63428141428ee0fd1a3ac65
xenapi: strip base_mirror after live-migrate

There is a bug in XenServer CA-98606 that means you get base_mirror key
left over after a block live-migrate.

This change ensures to strip out that key after error live migrate, to
ensure the key is never left around in a way that means the next live
migrate would fail.

Fixes bug 1234752
Change-Id: Icd6ba17039b50ae20d252d7c052120abe7de0deb
Utilizes assertIsNone and assertIsNotNone - tests/virt

Using assertTrue and the 'is None' operator to test if an element is None
is too python2.4. Our unit testing framework 'testtools' supports
assertIsNone and assertIsNotNone, included from python 2.7,
which were created for these types of tests.

Change-Id: Iee1379b941f93388900e89388676000b845fc8fc
Fix migration 185 to work with old fkey names

Migration 133_folsom.py accidentally changed the name of the FK
constraint on instance_info_caches from instance_info_caches_ibfk_1
to instance_info_caches_instance_uuid_fkey and on virtual_interfaces
from virtual_interfaces_ibfk_1 to
virtual_interfaces_instance_uuid_fkey meaning databases who have
upgraded from before folsom have the old fkey.

This patch adds a check for those with the old fkey name to make sure
it is dropped before changing unique constraints (as is required by
MySQL). It also fixes the fkey name to be as defined in 133 if it
wasn't before (which will persist on downgrade being consistent with
those who have come in after folsom).

Closes-Bug: #1245502

Change-Id: Ib0dcd04fcb9ed776c76d40561181abad2e14f76f
Comments for db.api.compute_node_*() methods

This patch provides the compute_node_*() methods in the db.api module
with more detailed comments (including :param and :returns comments).

Change-Id: I8d292fb9a163d24f34451e747ed1701083ba7c63
Use _get_server_admin_password()

There is _get_server_admin_password() for getting an admin password
in ServersController class. This patch makes some methods use it for
code clean-up.

Change-Id: Iff9d960126e1c09d928d72b572838e6f16cc4f33
Add auth_token settings to nova.conf.sample.

Updates our example config file so that it includes configuration
settings for the auth_token middleware.

Includes the latest generate_sample.sh from Oslo.

Related-Bug: #1240753

Change-Id: I393a67f1f005e775928130c9241aa7e25c391ae3