#NEWLINE# def get_context_data( self , **kwargs ) : #NEWLINE# #INDENT# context = super ( CreateSnapshotView , self ) . get_context_data ( ** kwargs ) #NEWLINE# context [ 'volume_id' ] = self . kwargs [ 'volume_id' ] #NEWLINE# try : #NEWLINE# #INDENT# volume = cinder . volume_get ( self . request , context [ 'volume_id' ] ) #NEWLINE# if ( volume . status == 'in-use' ) : #NEWLINE# #INDENT# context [ 'attached' ] = True #NEWLINE# context [ 'form' ] . set_warning ( _ ( 'This volume is currently attached to an instance. In some cases, creating a snapshot from an attached volume can result in a corrupted snapshot.' ) ) #NEWLINE# #UNINDENT# context [ 'usages' ] = quotas . tenant_limit_usages ( self . request ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( self . request , _ ( 'Unable to retrieve volume information.' ) ) #NEWLINE# #UNINDENT# return context