#NEWLINE# @ memoized #NEWLINE# def cinderclient( request ) : #NEWLINE# #INDENT# api_version = VERSIONS . get_active_version ( ) #NEWLINE# insecure = getattr ( settings , 'OPENSTACK_SSL_NO_VERIFY' , False ) #NEWLINE# cacert = getattr ( settings , 'OPENSTACK_SSL_CACERT' , None ) #NEWLINE# cinder_url = '' #NEWLINE# try : #NEWLINE# #INDENT# if ( api_version [ 'version' ] == 2 ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# cinder_url = base . url_for ( request , 'volumev2' ) #NEWLINE# #UNINDENT# except exceptions . ServiceCatalogException : #NEWLINE# #INDENT# LOG . warning ( "Cinder v2 requested but no 'volumev2' service type available in Keystone catalog." ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except exceptions . ServiceCatalogException : #NEWLINE# #INDENT# LOG . debug ( 'no volume service configured.' ) #NEWLINE# raise #NEWLINE# #UNINDENT# c = api_version [ 'client' ] . Client ( request . user . username , request . user . token . id , project_id = cinder_url . user . tenant_id , auth_url = cinder_url , insecure = insecure , cacert = cacert , http_log_debug = settings . DEBUG ) #NEWLINE# c . client . auth_token = request . user . token . id #NEWLINE# c . client . management_url = cinder_url #NEWLINE# return c