Use mox object from moxstubout fixture

The moxstubout fixture creates a mox object which we can re-use in
tests.

It also ensures verify() is called, which it clearly wasn't in the
case of the qpid tests.

Change-Id: Ibf3326f18b160865012d40a5841b65438262c4df
Reduce duplicated code related to policies

This patch adds some logic that is currently duplicated throughout
Openstack. As part of this de-duplication, the patch also modifies
current implementation.

Major Changes:
    * check, set_rules, reset, init are now part of the Enforcer class
    * check was renamed into enforce
    * init was renamed into load_rules
    * It is now possible to load multiple files and have per instance
      rules instead of global rules.
    * There's a global instance of the Enforcer class that can be used as
      main enforcer.

        from openstack.common import policy
        ENFORCER = policy.ENFORCER
        ENFORCER.enforce(rule, target, creds)

Minor Changes:
    * Added do_raise to the enforce method
    * Enforcer instance is now passed to the Check call.

NOTE: If / once this patch gets in, I'll update other projects and port
them to the latest version.

Change-Id: Ife909bdf3277ef33c2fb1eae16ae261fa6374c63
Add basic lazy gettext implementation

This is the first part of an implementation towards
a deferred localization functionality in OpenStack.
This change adds a Message class for encapsulating a
translatable message and its relevant data, as well
as an example LogHandler of how such a class can be
used in the logging context.

bp delayed-message-translation

Change-Id: I8485a346d32925327ea9185e0da3822e4e19c2f5
Use zero-copy in ZeroMQ proxy (zmq-rpc-receiver)

Now, messages will not be copied into the Python memory space
from the C library. The 'topic' key *will* be copied, to make
use of several string/bytes functions that are available to us.
(Potentially, we might be able to work with this as a memoryview
in the future as a further optimization?)

Implements blueprint zmq-zero-copy

Change-Id: I20a700867ac642b1a1788b31e3a21f8a299c97c8
Merge "Use mox object from moxstubout fixture"
Merge "Use zero-copy in ZeroMQ proxy (zmq-rpc-receiver)"
Merge "Reduce duplicated code related to policies"
python3: python3 binary/text data compatbility

Python3 enforces the distinction between byte strings
far more rigorously than Python 2 does; binary data
cannot be automatically coerced to or from text data.

Use six to provide a fake file object for textual data.
It provides an alias for StringIO.StringIO in python2
and io.StringIO in python3

Change-Id: I65897bb0cca2cbeb5819a769b98645c9eb066401
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Silence exceptions from qpid connection.close()

Fixes bug 1185465

Don't log exceptions that happen during connection.close().  They're
not surprising (a closed socket can't be read or written), don't
require sysadmin attention, and provide red herrings in the logs
to distract from finding real root causes of problems.

Change-Id: Ie414ba3f4ff1f1dee13e6168ac2e28dab535581b
python3: Introduce py33 to tox.ini

Introduce py33 to tox.ini to make testing with
python3 easier.

Change-Id: I9a5a7e8258afc31b9d29b2845d98e7e9c552e88d
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Enable hacking H402 test

H402  one line docstring needs punctuation

Change-Id: Ie848453cace318d8310cdf0234c512f4c1121119
Merge "python3: Introduce py33 to tox.ini"
Merge "python3: python3 binary/text data compatbility"
Add a slave db handle for the SQLAlchemy backend.

Adds an option for a slave DB connection for scaling
purposes. Read queries can be sent here to spread out
db load a bit. This patch adds a new configuration option:
slave_connection.

Implements: blueprint db-slave-handle
Change-Id: I5cc5e0696e3fcd8609ee6b5466b0377ca52b8b58
DocImpact
Merge "Add a slave db handle for the SQLAlchemy backend."
Fix problem with long messages in Qpid

Qpid has a limitation where it cannot serialize a dict containing
a string greater than 65535 characters.  This change alters the
Qpid implementation to JSON encode the dict before sending it, but
only if Qpid would fail to serialize it.  This maintains as much
backward compatibility as possible, though long messages will
still fail if they are sent to an older receiver.

Fixes bug 1175808

Change-Id: I5d104e099f523508dae2b657f7d06d96984b10f0
Rename requires files to standard names.

Rename tools/pip-requires to requirements.txt and tools/test-requires
to test-requirements.txt. These are standard files, and tools in the
general world are growing intelligence about them.

Fixes: bug #1179008
Change-Id: I033876ec304fea97c66365c16bcf0cccaa1d810e
Enable H306 hacking check.

H306 - imports not in alphabetical order.

Change-Id: Iaa93bcafed562833318ac86241ad36662c2d8ca6
Merge "Enable H306 hacking check."
Add common code for fileutils.

This code is present in nova, cinder and also needed by ironic package.
* delete_if_exists
* remove_path_on_error

Also added some tests.

openstack/common/fileutils.py => nova.common.utils <=> cinder.common.utils

Change-Id: Id5001db161bb8e7dfb20d1b2cc2033e886cda32f
Implements: blueprint image-tools