#NEWLINE# def project_update_event( self , proj_info ) : #NEWLINE# #INDENT# "Process project update event.\n\n        There could be change in project name. DCNM doesn't allow change in\n        project (a.k.a tenant). This event may be received for the DCI update.\n        If the change is for DCI, update the DCI portion of the project name\n        and send the update event to the DCNM.\n        " #NEWLINE# LOG . debug ( 'Processing project_update_event %(proj)s.' , { #NEWLINE# #INDENT# 'proj' : proj_info , #NEWLINE# #UNINDENT# } ) #NEWLINE# proj_id = proj_info . get ( 'resource_info' ) #NEWLINE# try : #NEWLINE# #INDENT# proj = self . keystone_event . _service . projects . get ( proj_id ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Failed to find project %s.' ) , proj_id ) #NEWLINE# return #NEWLINE# #UNINDENT# ( new_proj_name , new_dci_id ) = self . _get_dci_id_and_proj_name ( new_proj_name . name ) #NEWLINE# orig_proj_name = self . get_project_name ( proj_id ) #NEWLINE# orig_dci_id = self . get_dci_id ( proj_id ) #NEWLINE# if ( ( orig_proj_name == new_proj_name ) and ( new_dci_id == orig_dci_id ) ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Project update event for %(proj)s is received without changing in the project name: %(orig_proj)s. Ignoring the event.' ) , { #NEWLINE# #INDENT# 'proj' : proj_id , #NEWLINE# 'orig_proj' : orig_proj_name , #NEWLINE# #UNINDENT# } ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( orig_proj_name != new_proj_name ) : #NEWLINE# #INDENT# LOG . debug ( 'Update request cannot be processed as name of project is changed: %(proj)s %(orig_name)s %(orig_dci)s to %(new_name)s %(new_dci)s.' , { #NEWLINE# #INDENT# 'proj' : proj_id , #NEWLINE# 'orig_name' : orig_proj_name , #NEWLINE# 'orig_dci' : orig_dci_id , #NEWLINE# 'new_name' : new_proj_name , #NEWLINE# 'new_dci' : new_dci_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# return #NEWLINE# #UNINDENT# LOG . debug ( 'Changing project DCI id for %(proj)s from %(orig_dci)s to %(new_dci)s.' , { #NEWLINE# #INDENT# 'proj' : proj_id , #NEWLINE# 'orig_dci' : orig_dci_id , #NEWLINE# 'new_dci' : new_dci_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# try : #NEWLINE# #INDENT# self . dcnm_client . update_project ( new_proj_name , self . cfg . dcnm . default_partition_name , new_dci_id ) #NEWLINE# #UNINDENT# except dexc . DfaClientRequestFailed : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Failed to update project %s on DCNM.' ) , new_proj_name ) #NEWLINE# self . update_project_info_cache ( proj_id , name = new_proj_name , dci_id = new_dci_id , opcode = 'update' , result = constants . UPDATE_FAIL ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . update_project_info_cache ( proj_id , name = new_proj_name , dci_id = new_dci_id , opcode = 'update' ) #NEWLINE# LOG . debug ( 'Updated project %(proj)s %(name)s.' , { #NEWLINE# #INDENT# 'proj' : proj_id , #NEWLINE# 'name' : proj . name , #NEWLINE# #UNINDENT# } )