Adds upper bound checking for flavor create parameters

The flavor-create API does validation that root_gb and
other integer values are positive integers but it doesn't
do an upper bounds check to make sure they aren't longs.
If a user tries to create a flavor with an integer value
that is bigger than an int, the python int() method
(used in the validation) will just convert it to a long but
the database model for InstanceTypes defines the column as
an Integer (not a BigInteger) and then the database has
to handle the value.

This changeset adds upperbounds checking for memory_mb,
vcpus, root_gb, ephemeral_gb and swap.

Also adds missing testcase for ephermal_gb validity

Change-Id: I63ef42e6befeff1edb81bc9caded2df2a4654b8c
Closes-Bug: 1243195
clean up numeric expressions with byte constants

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

Implements: blueprint byte-unit-clean

Change-Id: I71aba00ac3c33931082cf0402e4b68764caa0212
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
network tests: replace assertEquals with assertEqual

In Python 2.6, both assertEqual and assertEquals are
convenience aliases to failUnlessEqual.

In Python 3, failUnlessEqual is explicitly deprecated.

This is part of blueprint assertequal

Change-Id: I2184bcb14a5bfc413bc78a884c5a9b681c39ac99
Merge "consoleauth: retain havana rpc client compat"
Merge "Remove consoleauth 1.X rpc api"
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
Claim IPv6 is unsupported if no interface with IPv6 configured

When IPv6 is supported by glibc but no interface
is configured to use ipv6 (because the ipv6 module
is not loaded), skip ipv6 related checks.

Change-Id: I15aaf3d01f0f51bdc0bd29f30728ca2ab8b5c30a
Make security_group_rule_get_by_security_group() honor columns

This makes the above-mentioned method take a columns_to_join
parameter, which lets us control it preloading behavior.

Related to blueprint compute-manager-objects

Change-Id: Ie2404633045c4ebac74225a44cbb609cf4c70887
Add InstanceList.get_by_security_group()

This provides a way to get a list of instances that are in a given
security group. This alternative to SecurityGroup.instances is
much simpler and avoids the potential for passing around a
SecurityGroup object with a ton of Instance objects attached.

Related to blueprint compute-manager-objects

Change-Id: Iea282ea3559da00a03121d6eff59125a5fbae0b2
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
Merge "Adds upper bound checking for flavor create parameters"
Merge "Allow _sync_power_states periodic task to hit slave DB"
Include name/level in unit test log messages

Use a more informative format than just the raw message string in log
messages captured by fixtures.FakeLogger during unit testing.  For
example, this changes cryptic unit test output such as

    pythonlogging:'': {{{
    214 -> 215...
    done
    215 -> 216...
    done
    }}}

into:

    pythonlogging:'': {{{
    INFO [migrate.versioning.api] 214 -> 215...
    INFO [migrate.versioning.api] done
    INFO [migrate.versioning.api] 215 -> 216...
    INFO [migrate.versioning.api] done
    }}}

which instantly makes it clearer that these numbers come from database
migrations.

Change-Id: I56b6fa03892e6d865ccb036fdf75d2bb499b6c93
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
Merge "Raise an error if module import fails."
Imported Translations from Transifex

Change-Id: Ic634aa2cd5a7c9079a9d261a40961532e9bab35e
Add DeleteFromSelect to avoid database's limit

nova-manage db archive_deleted_rows fails if max_rows is a large
number. Database has a limit of maximum sql variables in one SQL
statement. It is more efficient to insert(select) directly and then
delete(same select) without ever returning the selected rows back to
Python. This also can avoid database's limit.

Closes-Bug: #1214720

Change-Id: I29e3a5ce14c59dd2979e45e8d31fc3df04c70266
Merge "Correct update extension point's check_func for v3 server's controller"
replaced e.message with unicode(e)

BaseException.message has been deprecated as of Python 2.6

Change-Id: I9ac936d707592cd627c57ce56ac67a8da7e55f39