Fix traceback when detaching volumes via EC2
Fix traceback when detaching volumes via EC2

When detaching a volume from an instance it results
in the following traceback:

Cinderclient connection created using URL: http://192.168.1.103:8776/v1/bc02ec05c5fa4a5bb3020b617f3574e2
2012-08-06 18:58:32 ERROR nova.api.ec2 [req-1fd2f017-8a11-481f-b901-ae61d3f55c94 demo demo] Unexpected error raised: 'instance_uuid'
2012-08-06 18:58:32 TRACE nova.api.ec2 Traceback (most recent call last):
2012-08-06 18:58:32 TRACE nova.api.ec2   File "/opt/stack/nova/nova/api/ec2/__init__.py", line 474, in __call__
2012-08-06 18:58:32 TRACE nova.api.ec2     result = api_request.invoke(context)
2012-08-06 18:58:32 TRACE nova.api.ec2   File "/opt/stack/nova/nova/api/ec2/apirequest.py", line 81, in invoke
2012-08-06 18:58:32 TRACE nova.api.ec2     result = method(context, **args)
2012-08-06 18:58:32 TRACE nova.api.ec2   File "/opt/stack/nova/nova/api/ec2/cloud.py", line 799, in detach_volume
2012-08-06 18:58:32 TRACE nova.api.ec2     self.compute_api.detach_volume(context,volume_id=volume_id)
2012-08-06 18:58:32 TRACE nova.api.ec2   File "/opt/stack/nova/nova/compute/api.py", line 1642, in detach_volume
2012-08-06 18:58:32 TRACE nova.api.ec2     instance_uuid = volume['instance_uuid']
2012-08-06 18:58:32 TRACE nova.api.ec2 KeyError: 'instance_uuid'

By the time the volume in the cinder database the instance_uuid is already 'NULL',
so get the instance_uuid from the volume before its detached.

Fixes LP: #1033713

Change-Id: Id5515881b08af9d0832b4b620c03e471fdff0823
Signed-off-by: Chuck Short <753a8074f04ffd62a8fff7516e3ae689be8e35ad@canonical.com>

openstack/nova,noironetworks/nova,phenoxim/nova,JioCloud/nova,klmitch/nova,fajoy/nova,rajalokan/nova,alexandrucoman/vbox-nova-driver,whitepages/nova,hanlind/nova,silenceli/nova,vmturbo/nova,dawnpower/nova,devendermishrajio/nova,takeshineshiro/nova,mgagne/nova,MountainWei/nova,Juniper/nova,takeshineshiro/nova,kimjaejoong/nova,mandeepdhami/nova,barnsnake351/nova,varunarya10/nova_test_latest,joker946/nova,cernops/nova,saleemjaveds/https-github.com-openstack-nova,Triv90/Nova,imsplitbit/nova,watonyweng/nova,Francis-Liu/animated-broccoli,CEG-FYP-OpenStack/scheduler,yosshy/nova,petrutlucian94/nova,dstroppa/openstack-smartos-nova-grizzly,projectcalico/calico-nova,mikalstill/nova,NewpTone/stacklab-nova,shail2810/nova,bgxavier/nova,devendermishrajio/nova_test_latest,klmitch/nova,angdraug/nova,sridevikoushik31/openstack,maoy/zknova,zzicewind/nova,Yusuke1987/openstack_template,JioCloud/nova_test_latest,Yusuke1987/openstack_template,JioCloud/nova_test_latest,BeyondTheClouds/nova,raildo/nova,SUSE-Cloud/nova,thomasem/nova,isyippee/nova,shootstar/novatest,Metaswitch/calico-nova,klmitch/nova,NewpTone/stacklab-nova,cloudbase/nova-virtualbox,felixma/nova,yatinkumbhare/openstack-nova,Brocade-OpenSource/OpenStack-DNRM-Nova,sridevikoushik31/nova,sridevikoushik31/nova,raildo/nova,tangfeixiong/nova,badock/nova,NoBodyCam/TftpPxeBootBareMetal,tianweizhang/nova,vmturbo/nova,SUSE-Cloud/nova,qwefi/nova,MountainWei/nova,devoid/nova,gspilio/nova,mahak/nova,petrutlucian94/nova_dev,cloudbase/nova,kimjaejoong/nova,shahar-stratoscale/nova,tianweizhang/nova,Juniper/nova,badock/nova,sridevikoushik31/openstack,cernops/nova,belmiromoreira/nova,berrange/nova,DirectXMan12/nova-hacking,ewindisch/nova,savi-dev/nova,noironetworks/nova,iuliat/nova,j-carpentier/nova,cloudbau/nova,zaina/nova,edulramirez/nova,tangfeixiong/nova,openstack/nova,Tehsmash/nova,rrader/nova-docker-plugin,shail2810/nova,Triv90/Nova,CiscoSystems/nova,Stavitsky/nova,cloudbau/nova,sebrandon1/nova,ntt-sic/nova,isyippee/nova,jianghuaw/nova,Juniper/nova,cloudbase/nova,mahak/nova,vmturbo/nova,adelina-t/nova,akash1808/nova_test_latest,gspilio/nova,savi-dev/nova,CCI-MOC/nova,NeCTAR-RC/nova,fnordahl/nova,sridevikoushik31/openstack,klmitch/nova,gooddata/openstack-nova,Francis-Liu/animated-broccoli,plumgrid/plumgrid-nova,viggates/nova,alvarolopez/nova,alexandrucoman/vbox-nova-driver,orbitfp7/nova,rajalokan/nova,CCI-MOC/nova,houshengbo/nova_vmware_compute_driver,mmnelemane/nova,sebrandon1/nova,luogangyi/bcec-nova,jeffrey4l/nova,gspilio/nova,NoBodyCam/TftpPxeBootBareMetal,plumgrid/plumgrid-nova,eayunstack/nova,usc-isi/nova,maelnor/nova,joker946/nova,Metaswitch/calico-nova,maoy/zknova,tudorvio/nova,dstroppa/openstack-smartos-nova-grizzly,dims/nova,scripnichenko/nova,leilihh/novaha,fnordahl/nova,zzicewind/nova,mikalstill/nova,projectcalico/calico-nova,CloudServer/nova,bclau/nova,rickerc/nova_audit,orbitfp7/nova,apporc/nova,leilihh/nova,JioCloud/nova,cyx1231st/nova,eonpatapon/nova,alaski/nova,eharney/nova,Stavitsky/nova,iuliat/nova,berrange/nova,tudorvio/nova,spring-week-topos/nova-week,virtualopensystems/nova,whitepages/nova,belmiromoreira/nova,zhimin711/nova,paulmathews/nova,vladikr/nova_drafts,mgagne/nova,cyx1231st/nova,dstroppa/openstack-smartos-nova-grizzly,JianyuWang/nova,ewindisch/nova,DirectXMan12/nova-hacking,dawnpower/nova,ted-gould/nova,mmnelemane/nova,qwefi/nova,rahulunair/nova,NeCTAR-RC/nova,devendermishrajio/nova_test_latest,barnsnake351/nova,affo/nova,spring-week-topos/nova-week,maheshp/novatest,NewpTone/stacklab-nova,adelina-t/nova,aristanetworks/arista-ovs-nova,zaina/nova,CloudServer/nova,maoy/zknova,yrobla/nova,saleemjaveds/https-github.com-openstack-nova,sacharya/nova,eharney/nova,jianghuaw/nova,yrobla/nova,akash1808/nova,OpenAcademy-OpenStack/nova-scheduler,blueboxgroup/nova,tealover/nova,JianyuWang/nova,shahar-stratoscale/nova,houshengbo/nova_vmware_compute_driver,petrutlucian94/nova,phenoxim/nova,double12gzh/nova,mahak/nova,affo/nova,rahulunair/nova,openstack/nova,aristanetworks/arista-ovs-nova,Yuriy-Leonov/nova,ruslanloman/nova,cernops/nova,leilihh/nova,yosshy/nova,viggates/nova,houshengbo/nova_vmware_compute_driver,TieWei/nova,vmturbo/nova,fajoy/nova,fajoy/nova,hanlind/nova,yrobla/nova,gooddata/openstack-nova,thomasem/nova,tanglei528/nova,eayunstack/nova,BeyondTheClouds/nova,angdraug/nova,rahulunair/nova,sridevikoushik31/nova,nikesh-mahalka/nova,jianghuaw/nova,Yuriy-Leonov/nova,devendermishrajio/nova,petrutlucian94/nova_dev,sridevikoushik31/nova,BeyondTheClouds/nova,ntt-sic/nova,dims/nova,yatinkumbhare/openstack-nova,LoHChina/nova,rajalokan/nova,apporc/nova,cloudbase/nova,mandeepdhami/nova,imsplitbit/nova,bigswitch/nova,bigswitch/nova,Juniper/nova,Triv90/Nova,maheshp/novatest,tealover/nova,redhat-openstack/nova,sebrandon1/nova,blueboxgroup/nova,paulmathews/nova,NoBodyCam/TftpPxeBootBareMetal,varunarya10/nova_test_latest,tanglei528/nova,virtualopensystems/nova,rrader/nova-docker-plugin,luogangyi/bcec-nova,edulramirez/nova,usc-isi/nova,eonpatapon/nova,gooddata/openstack-nova,hanlind/nova,rickerc/nova_audit,DirectXMan12/nova-hacking,alaski/nova,devoid/nova,ruslanloman/nova,TwinkleChawla/nova,zhimin711/nova,mikalstill/nova,leilihh/novaha,usc-isi/nova,gooddata/openstack-nova,bgxavier/nova,cloudbase/nova-virtualbox,alvarolopez/nova,OpenAcademy-OpenStack/nova-scheduler,LoHChina/nova,sacharya/nova,Brocade-OpenSource/OpenStack-DNRM-Nova,double12gzh/nova,vladikr/nova_drafts,nikesh-mahalka/nova,citrix-openstack-build/nova,jianghuaw/nova,scripnichenko/nova,CiscoSystems/nova,bclau/nova,j-carpentier/nova,redhat-openstack/nova,watonyweng/nova,maelnor/nova,jeffrey4l/nova,silenceli/nova,rajalokan/nova,CEG-FYP-OpenStack/scheduler,Tehsmash/nova,citrix-openstack-build/nova,paulmathews/nova,maheshp/novatest,akash1808/nova_test_latest,shootstar/novatest,ted-gould/nova,akash1808/nova,savi-dev/nova,felixma/nova,aristanetworks/arista-ovs-nova,TieWei/nova,TwinkleChawla/nova