#NEWLINE# def port_create_event( self , port_info ) : #NEWLINE# #INDENT# port = port_info . get ( 'port' ) #NEWLINE# if ( not port ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# vm_info = self . _make_vm_info ( port , 'up' ) #NEWLINE# port_id = port . get ( 'id' ) #NEWLINE# self . port [ port_id ] = port_id #NEWLINE# LOG . debug ( 'port_create_event : %s' , vm_info ) #NEWLINE# if ( ( not port . get ( 'binding:host_id' ) ) and ( port . get ( 'binding:vif_type' ) . lower ( ) == 'unbound' ) ) : #NEWLINE# #INDENT# self . add_vms_db ( vm_info , constants . RESULT_SUCCESS ) #NEWLINE# LOG . debug ( 'Port %s created with no binding host and vif_type.' , port_id ) #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . neutron_event . send_vm_info ( str ( vm_info . get ( 'host' ) ) , str ( vm_info ) ) #NEWLINE# #UNINDENT# except ( rpc . MessagingTimeout , rpc . RPCException , rpc . RemoteError ) : #NEWLINE# #INDENT# if ( not self . dcnm_dhcp ) : #NEWLINE# #INDENT# vm_info [ 'oui' ] [ 'ip_addr' ] += constants . IP_DHCP_WAIT #NEWLINE# #UNINDENT# self . add_vms_db ( vm_info , constants . CREATE_FAIL ) #NEWLINE# LOG . error ( _LE ( 'Failed to send VM info to agent.' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . dcnm_dhcp ) : #NEWLINE# #INDENT# vm_info [ 'oui' ] [ 'ip_addr' ] += constants . IP_DHCP_WAIT #NEWLINE# #UNINDENT# self . add_vms_db ( vm_info , constants . RESULT_SUCCESS )