Return error details to users in "dns-create-private-domain"

Fixes bug 1135539
When SysLogHandler is configured in UDP socket mode, the user
who doesn't have the admin privilege got the unexpecting internal
server error(HTTP 500) in "nova dns-create-private-domain" command.
This bug occurs as the call graph drew below:

|--ProxyCallback._process_data():amqp.py
                          |--LOG.exception()
                          |    :
                          |    |--BaseHub.switch():hub.py
                          |                 |-- clear_sys_exc_info()
                          |
                          |--ctxt.reply(None, sys.exc_info(),..)
                                       |
                                       :
                                       |
                         |--serialize_remote_exception():common.py
                                       |--failure_info#(None,None,None)

The sys.exc_info() is cleared by the clear_sys_exc_info(), but it is
called again by the ctxt.reply().
This patch prevents the internal error and returns the details of
the forbidden error(HTTP 403) which is expected.

Change-Id: I76d4a938e66bfaf44423f7586e00db2caf9f5dde
xenapi: Adding logging for migration plugin

With this change administrators will be able to examine hypervisor
logs for real-time progress of rsync operations (resizes, migrates).

Change-Id: I463b574be1021e141fe2c8380b9c07f6cd860c78
Prevent volume-attach/detach from instances in rescue state

Rescue is supposed to just be a way to log into a wayward instance
if something goes wrong with the base image that may have had some data
(logfiles etc.) and make it possible to grab that  - block devices are
assumed to be accessible by re-attaching them, and are considered
persistant so no need for rescue there.

Since there is no need to attach a volume in rescue mode, and detaching a
volume that was previously attached doesn't work, just ban volume
attach/detach in rescue state.

Fixes bug 1126187

Change-Id: Ifdf164155942cdeb2bbdfcd1dce0dd2e125b507c
Fix RequestContext crashes w/ no service catalog

Code introduced in a prev review assumed service_catalog will be
at least an empty list and will never be None.  But missed one code
path where the service_catalog could potentially be set to None. So
this change switches back the default value of service_catalog in
the arguments to None and makes sure we tolerate anyone else
passing in a None or Empty list as service_catalog

Fix for LP# 1156730

Change-Id: I480b761d57c4699ea7ef72114160cdbeb281e454
Fixes PowerVM spawn failed as missing attr supported_instances

During test in a cross-hypervisor environment (KVM+PowerVM), user will run
into an issue during deploying an instance for Power host by PowerVM driver,
though the property "hypervisor_type" for the PowerVM image have been
configured. Since the _update_host_stats of PowerVM driver missing the
attribute "supported_instances".

Fixes bug: 1155498

Change-Id: I81259d153a7b5ae35747e57c53b14e0075d28d78
Require netaddr>=0.7.6 to avoid UnboundLocalError

This issue is discussed at https://github.com/drkjam/netaddr/issues/2.
The bug in netaddr was fixed in release 0.7.6 on 13th Sep 2011.

Change-Id: Iea75a30963a09f9b0dd94138460bf041ab98fc66
Fixes: bug #1157058
Ensure that headers are returned as strings, not integers.

The 'Retry-After' header was set as an integer, and it was causing that
mod_wsgi failed with a 500 error, instead of the actual error. This
ensures that the headers are converted to str.

Fixes bug 1155585
Change-Id: If1b1de2308ccdc6f0588c8df5dc896fe5f767dbe
Merge "Require netaddr>=0.7.6 to avoid UnboundLocalError"
Merge "Fix RequestContext crashes w/ no service catalog"
Merge "Fixes PowerVM spawn failed as missing attr supported_instances"
Merge "Return error details to users in "dns-create-private-domain""
Merge "xenapi: Adding logging for migration plugin"
Add missing tests for db.service_* methods

There was no tests in test_db_api for service_* methods.

Add tests to ensure that all works. Also these tests allow us to refactor
work with session in these methods.

blueprint db-api-tests

Change-Id: I0c3b233e1290f08ea01a8c64eacb95af1eae6f24
Fix multiple fixed-ips with quantum.

This patch fixes a bug in the quantum suppot where multiple requested
fixed-ips did not work.  Every network interface would be given the last
fixed IP that was specified.  The problem was just the lack of putting
the right fixed ip in a local variable.

Fix bug 1154093.

Change-Id: Ie7e034e19a38c8431540c81b023ff4800aa6ec50
Add missing tests for db.virtual_interface_* methods

There was no tests in test_db_api for virtual_interface_* methods.

Add tests to ensure that all works.

This allow us to refactor these methods to use soft_delete instead of
delete.

Found bug 1156227 in sqlite we have lost UC on virtual_interfaces.address
after 152_* migration. To fix it we should add new db migration, so it will be
fixed in Havana-1.

blueprint db-api-tests

Change-Id: Ide03163b230762d65bf3cd7b5fe8f0a303fea5ae
Fix missing argument to QemuImageInfo

set the default value for cmd_output to None. _parse
does work fine with None or empty string

Fixes LP# 1157412

Change-Id: Ib63f2fd227633b96db613ce29563d1929536819a
Fix console support with cells

The (relatively recent) security fixes for consoleauth do not work
with cells because consoleauth and the compute manager for the instance
talk to different rabbit servers.  consoleauth is in the API cell and
the compute manager is in a child cell.

This patch adds code to proxy the following via cells:

1) compute -> consoleauth's delete_tokens_for_instance()
2) consoleauth -> compute's validate_console_port()

Also: On instance deletion when the compute manager tells consoleauth to
delete tokens for the instance, it's not necessary to do an rpc.call and
block.  The only purpose it could serve would be log a traceback on failure
on the compute manager side, but that seems unnecessary.  There's no
return value.  This patch changes it to an rpc.cast instead.

Fixes bug 1154755

Change-Id: Ic763f2a5c0dcff7b7ccfac5927680e7881605f61
Refactor db.service_destroy and db.service_update methods

Remove session parameter from db.service_get method

Optimize db.service_destroy:
Was:
1 request with join to get service with compute_node
1 request to delete service
1(0) to delete compute_node
Now:
1 request (without join) to delete service
1 request to delete compute_node

Optimize db.service_update:
Remove unused join.

Fixes bug 1157442

blueprint db-session-cleanup

Change-Id: Ifcc8fdebfc95daec736464cbc9e16301116540aa
Merge "Ensure that headers are returned as strings, not integers."
Merge "Prevent volume-attach/detach from instances in rescue state"