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
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
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
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
Pass thru credentials to allow re-authentication

Nova's network client obtains a token from keystone for authenitcation
to the neutron services.  When the timeout of keystone is set low, it
creates a condition where some of the invocations to neutron start
failing.

This is because the neutron client detects that the token is expired,
but during the re-authorization attempt fails due to not having enough
information to properly reauthorize.  Nova also assumes that within a
given context, the token will always be valid.  It does not perform the
authorization check (and doing so would be double verification as the
neutron client is already validating this).

Since the neutron client has logic in place to re-authorize the token,
this change set will pass thru the credentials to the neutron client
for the re-authorization attempts.  This change also updates the unit
tests.

Note: the change only will pass in the admin credential information
if the context indicates that it is an admin.

Change-Id: I2858562b180f3e058a2da9d67bef02af80927177
Closes-Bug: #1241275
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
Utilizes assertIsNone and assertIsNotNone - tests/api

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: I09f38e219931e0d7ad27f04861d1ebbc3b5e2c5f
clean up numeric expressions in tests

Replace numeric expressions with constants in nova/tests
to make code more readable.

Implements: blueprint byte-unit-clean

Change-Id: Ic074ab07fa84b32805647201cd5ff433f3e7949c
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
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
xenapi: workaround for failing vbd detach

Sometimes xapi returns with an internal error during unplug_vbd. This
patch adds a workaround for XenServer 6.2 by inspecting the error
message, and retry the unplug.

In addition, this also ensures that sleep is no longer called after the
last retry before raising an exception.

Fixes bug 1217972
Change-Id: I7b86325714e38b00a2f51bbf083b5532a6c51fa9
Adds V3 API samples for user-data

Adds V3 API sample tests and api samples for user-data

Partially implements blueprint v3-api-unittests
Partially implements blueprint v3-api-specification

Change-Id: I3a29490061632d7f728edcb942a061c3b65518bd
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
Make virt/firewall use objects for Security Groups and Rules

This makes the virt/firewall module use SecurityGroup and
SecurityGroupRule objects instead of relying on virtapi and
conductor for these operations.

Related to blueprint compute-manager-objects
Related to blueprint virt-objects

Change-Id: I39cb9422cb15e6222f5009f64706f1528035f42d
Remove security_group-related methods from VirtAPI

This patch removes the no-longer-needed security_group-related
methods from VirtAPI.

Related to blueprint compute-manager-objects
Related to blueprint virt-objects

Change-Id: I0326f25754e7a13dfc18f207242052412189c743
Merge "Utilizes assertIsNone and assertIsNotNone - tests/api"
Merge "Fix bad typo in cloudpipe.py"
Merge "Pass thru credentials to allow re-authentication"
Merge "xenapi: workaround for failing vbd detach"