Add a format_message method to the Exceptions

This patch adds a format_message method to the NovaException class that
will almost always do what a user wants, when they want to print out the
message of the exception.

Exceptions that are received through RPC are turned into an actual
exception classes by the deserialize_remote_exception function of the
nova.openstack.common.rpc.common module. This function then overrides
__str__ and __unicode__ methods of a new class to print the whole trace.
We still want to preserve this functionality (for logging) but do not
want to leak the trace back to the user in the HTTP response.

Based on the above, This patch attempts to establish a convention that
states: if you need to get the message of a NovaException subclass -
always use the format_message method. Only use str(e) or unicode(e) when
you suspect that they were overriden.

Initially this was attempted through adding a custom metaclass to the
NovaException class so that format_message cannot be overridden in
subclasses, however due to a bug in testtools - many tests were failing.
A patch was proposed to testtols to remedy this
(https://github.com/testing-cabal/testtools/pull/34) however until it is
merged, we cannot use metaclasses with our exception classes as they
cause tests to fail.

(cherry picked from commit b936df8c1ec47300540403ebb6833f0fbf5f195f)

Conflicts:

	nova/tests/test_exception.py

Change-Id: I0a399b9ab3227bad644b031c9b689fe0ce64586e
Use format_message on exceptions instead of str()

This patch changes all usages of unicode() and str() in the API layer
(and most other reasonable places) into a new format_message method.
This is done in order to avoid leaking the stack trace back to the
user through the Remote excepitons.

This patch deliberately avoids the EC2 api as the way how the EC2 API
handles responses is being worked on as part of another blueprint.

Fixes bug 1159755

(cherry picked from commit 86031940b313532606449c400bca64707be1797a)

Conflicts:

	nova/api/openstack/compute/contrib/admin_actions.py
	nova/api/openstack/compute/contrib/agents.py
	nova/api/openstack/compute/contrib/console_output.py
	nova/api/openstack/compute/contrib/consoles.py
	nova/api/openstack/compute/contrib/deferred_delete.py
	nova/api/openstack/compute/contrib/fixed_ips.py
	nova/api/openstack/compute/contrib/flavorextraspecs.py
	nova/api/openstack/compute/contrib/flavormanage.py
	nova/api/openstack/compute/contrib/floating_ips_bulk.py
	nova/api/openstack/compute/contrib/hosts.py
	nova/api/openstack/compute/contrib/rescue.py
	nova/api/openstack/compute/contrib/server_password.py
	nova/api/openstack/compute/contrib/server_start_stop.py
	nova/api/openstack/compute/servers.py

Change-Id: I04a74682c4fac9a66ba25b52fd5c7af5e10e81e8
Merge "Add a format_message method to the Exceptions" into stable/folsom
Merge "Use format_message on exceptions instead of str()" into stable/folsom
Fix Network object encoding issue when using qpid

When creating network via REST API will throw the exception
"CodecException: no encoding for
<nova.db.sqlalchemy.models.Network object at 0x4a8ea10>".
It only occurs when using qpid.
Fix this issue through using jsonutils.to_primitive method.

Fix bug 1143584.

Change-Id: I833aef451f8e3d5eaa246c19d67b2474a9d36910
(cherry picked from commit b4d43b0d0c890ccb940862719c6b88a24029d44a)
Final versioning for 2012.2.4

Change-Id: Ic9ee9a7336c8f5f64ad4700c0322653e331c10bb
Bump version to 2012.2.5

Change-Id: Ibf237525fc86d5ba2129620f58d574685a713782