Use osapi_glance_link_prefix for image location header

When an image is created the location header returned is generated based
on the request url that nova-api receives.  If SSL termination happens
upstream the request url is an http request, and the location header is
wrongly generated with that.  The osapi_glance_link_prefix config option
is available for almost precisely this purpose, so let's use it.

Change-Id: I24e46ed8fc0763f9ddeec65e0d79590dd7b86bef
Closes-bug: 1298005
XenAPI: Add host information to glance download logs

This change adds a context field to the xenapi session
call_plugin_serialized_with_retry method to provide better
logging information.  This is then used by the glance image
downloading to provide the host IP we are contacting.  This
saves having to dig through other logs to get this information.

I added a mock unit test to test_glance to verify the download
retry mechanism works since this wasn't verified before.
It is the first mock test in test_glance.py

Change-Id: I4de2b9e61ce25fb8ab693eac2f67559d0eb01a77
Fix bug detach volume fails with "KeyError" in EC2

Modified volume['instance_uuid'] to volume.get('instance_uuid'),
to avoid "KeyError", when detach a volume with "attaching" status.

Change-Id: Ic1aacab212c2a2026d18ef57ad9d77fdc6d86b47
Closes-Bug: #1280532
Add RBAC policy for ec2 API security groups calls

The revoke_security_group_ingress, revoke_security_group_ingress, and
delete_security_group calls in the ec2 API were not restricted by policy
checks.  This prevented a deployer from restricting their usage via
roles or other checks.  Checks have been added for these calls.

Closes-Bug: #1290537
Change-Id: I4bf681bedd68ed2216b429d34db735823e0a6189
Read deleted instances during lifecycle events

This prevents us from failing to find the associated instance if
the lifecycle event happens after the instance has been deleted,
as in the case of a ... delete.

Change-Id: I819ddf8ff68edc407d7932bf43771c440f514f26
Closes-bug: #1304968
Merge "XenAPI: Add host information to glance download logs"
Merge "Add RBAC policy for ec2 API security groups calls"
Merge "Read deleted instances during lifecycle events"
Merge "Use osapi_glance_link_prefix for image location header"
Merge "Fix bug detach volume fails with "KeyError" in EC2"
Merge commit 'refs/changes/38/84138/2' of git://gold.eng.hq.xensource.com/git/github/openstack/nova into tmpbranch