Move rootwrap code to openstack.common

Copies current nova-rootwrap code to openstack.common, so that it
can be reused by Cinder and Quantum.

Implements blueprint common-rootwrap.

Before it can be used in projects, update.py needs to grow the
capability to deploy files in bin/ and etc/, as well as replacing
a placeholder text by the destination project name in source files
and binary names.

In this proposed version, the placeholder text is "oslo".

Change-Id: I8655d5b3cccacd1cc2225aa539339fb478615422
fix intermittent failures with deferred version test

Need to get rid of the deferred string approach as
the problem was overriding string methods is hard and
flaky.  There is just no other documented
argparse hook to allow deferring of the version
calculation as version passed in has to be a str
or buffer. Added a test to try longer string and even
run it in a loop just to be sure.

Fixes LP #1087575

Change-Id: Icf83944d67b8ce5d3230627f3de10501da3276f2
Don't use exclusive queues for fanout and direct

The use of exclusive queues can cause issues on reconnect if the
rabbit server hasn't deleted the queue already. We might as well
use exclusive=False so that we can reconnect to the queue if
necessary.

Fixes bug 1094358

Change-Id: I35bd903737d6054e8856b0003b0b8af97fd21c91
Don't rely on os.wait() blocking

Before this fix which was included in eventlet 0.10.0:

https://bitbucket.org/which_linden/eventlet/issue/92/eventletgreen-override-of-oswaitpid

the os.wait() wrapper in eventlet would not block if no child processes
had exited. This was clearly buggy behaviour and os.wait() no blocks
correctly. However, it appears it now does not return if the parent process
was interrupted by a signal. This means that you can't kill the parent process
and have the child processes cleaned up gracefully.

To avoid all these issues, switch to non-blocking wait behaviour. We use
WNOHANG with waitpid() to poll for an exited child process and, if there
is none, we yield to other green threads and sleep for a short period.
This means excessive CPU usage, though, which will be tracked by
bug #1095346.

Check pid to avoid some unnecessary warning/info messages in the logs

Fixes LP #1094076

Change-Id: I783fac652376c2daa9d591403b9f4c1fe9523043
Add a rpc envelope format version number.

This patch adds a message envelope that includes a envelope format
version number.  This message envelope will allow us to embed
additional metadata later on, such as a signature for the message
payload.

Up to this point, we've deferred message serialization as a
responsibility of the messaging library we're using by passing it a
message as Python types and letting it deal with how to pass it over a
network.  This patch adds json serialization in the rpc layer of the
application message payload before passing the message down into the
messaging library.

There are some benefits to be gained by doing a pass at serialization
ourselves.  As an example, we occasionally hit serialization bugs that
only affect some messaging drivers.  The kombu driver has always had a
nice advantage.  It uses anyjson internally for serializing messages,
which we hook into using our jsonutils module.  When there is a problem
serializing, we automatically use to_primitive() to fix it.  This patch
allows all drivers to take advantage of this automatic message fix-up.

This also creates a convenient common hook point for messages coming in
and out of the system, regardless of the driver in use.

While this changes the base format of the messages sent between nodes,
it has been done in a backwards compatible manner.  The new message
format will not be used by default.  The idea is that all nodes will be
upgraded to a version that is capable of receiving the new format
(Grizzly) before switching it on.  We will turn it on post-Grizzly.

Implement blueprint version-rpc-messages.

Change-Id: Ib6b2d11ca42abaa64c40986d72233e7048e504a0
Merge "fix intermittent failures with deferred version test"
Merge "Don't use exclusive queues for fanout and direct"
Merge "Move rootwrap code to openstack.common"
Merge "Add a rpc envelope format version number."