#NEWLINE# @ testtools . skipUnless ( CONF . aws . ebs_image_id , 'EBS image id is not defined' ) #NEWLINE# def test_attaching_stage( self ) : #NEWLINE# #INDENT# clean_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# instance_id = self . run_instance ( ImageId = CONF . aws . ebs_image_id , clean_dict = clean_dict ) #NEWLINE# clean_i = clean_dict [ 'instance' ] #NEWLINE# data = self . client . create_volume ( AvailabilityZone = CONF . aws . aws_zone , Size = 1 ) #NEWLINE# volume_id = data [ 'VolumeId' ] #NEWLINE# clean_v = self . addResourceCleanUp ( self . client . delete_volume , VolumeId = volume_id ) #NEWLINE# self . get_volume_waiter ( ) . wait_available ( volume_id ) #NEWLINE# device_name = '/dev/xvdh' #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'Device' : device_name , #NEWLINE# 'InstanceId' : instance_id , #NEWLINE# 'VolumeId' : volume_id , #NEWLINE# #UNINDENT# } #NEWLINE# data = self . client . attach_volume ( * [ ] , ** kwargs ) #NEWLINE# clean_vi = self . addResourceCleanUp ( self . client . detach_volume , VolumeId = volume_id ) #NEWLINE# self . assertEqual ( 'attaching' , data [ 'State' ] ) #NEWLINE# if CONF . aws . run_incompatible_tests : #NEWLINE# #INDENT# bdt = self . get_instance_bdm ( instance_id , device_name ) #NEWLINE# self . assertIsNotNone ( bdt ) #NEWLINE# self . assertEqual ( 'attaching' , bdt [ 'Ebs' ] [ 'Status' ] ) #NEWLINE# #UNINDENT# self . get_volume_attachment_waiter ( ) . wait_available ( volume_id , final_set = 'attached' ) #NEWLINE# self . cancelResourceCleanUp ( clean_i ) #NEWLINE# clean_i = self . addResourceCleanUp ( self . client . terminate_instances , InstanceIds = [ instance_id ] ) #NEWLINE# data = self . client . stop_instances ( InstanceIds = [ instance_id ] ) #NEWLINE# self . get_instance_waiter ( ) . wait_available ( instance_id , final_set = 'stopped' ) #NEWLINE# self . client . detach_volume ( VolumeId = volume_id ) #NEWLINE# self . get_volume_attachment_waiter ( ) . wait_delete ( volume_id ) #NEWLINE# self . cancelResourceCleanUp ( clean_vi ) #NEWLINE# self . client . delete_volume ( VolumeId = volume_id ) #NEWLINE# self . cancelResourceCleanUp ( clean_v ) #NEWLINE# self . get_volume_waiter ( ) . wait_delete ( volume_id ) #NEWLINE# self . client . terminate_instances ( InstanceIds = [ instance_id ] ) #NEWLINE# self . cancelResourceCleanUp ( clean_i ) #NEWLINE# self . get_instance_waiter ( ) . wait_delete ( instance_id )