#NEWLINE# @ classmethod #NEWLINE# def check_dhcp_resp( cls , **kwargs ) : #NEWLINE# #INDENT# 'Receiver method for check_dhcp task\n\n        For example of kwargs check FakeCheckingDhcpThread\n        ' #NEWLINE# logger . info ( 'RPC method check_dhcp_resp received: %s' , jsonutils . dumps ( kwargs ) ) #NEWLINE# messages = [ ] #NEWLINE# result = collections . defaultdict ( list ) #NEWLINE# message_template = 'Node {node_name} discovered DHCP server via {iface} with following parameters: IP: {server_id}, MAC: {mac}. This server will conflict with the installation.' #NEWLINE# task_uuid = kwargs . get ( 'task_uuid' ) #NEWLINE# nodes = kwargs . get ( 'nodes' , [ ] ) #NEWLINE# error_msg = kwargs . get ( 'error' ) #NEWLINE# status = kwargs . get ( 'status' ) #NEWLINE# progress = kwargs . get ( 'progress' ) #NEWLINE# nodes_uids = [ node [ 'uid' ] for node in nodes ] #NEWLINE# nodes_db = db ( ) . query ( Node ) . filter ( Node . id . in_ ( nodes_uids ) ) . all ( ) #NEWLINE# nodes_map = dict ( ( ( str ( node . id ) , node ) for node in nodes_db ) ) #NEWLINE# master_network_mac = settings . ADMIN_NETWORK [ 'mac' ] #NEWLINE# logger . debug ( 'Mac addr on master node %s' , master_network_mac ) #NEWLINE# for node in nodes : #NEWLINE# #INDENT# if ( node [ 'status' ] == 'ready' ) : #NEWLINE# #INDENT# for row in node . get ( 'data' , [ ] ) : #NEWLINE# #INDENT# if ( not net_utils . is_same_mac ( row [ 'mac' ] , master_network_mac ) ) : #NEWLINE# #INDENT# node_db = nodes_map . get ( node [ 'uid' ] ) #NEWLINE# if node : #NEWLINE# #INDENT# row [ 'node_name' ] = node_db . name #NEWLINE# message = message_template . format ( ** row ) #NEWLINE# messages . append ( message ) #NEWLINE# result [ node [ 'uid' ] ] . append ( row ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warning ( 'Received message from nonexistent node. Message %s' , row ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# status = ( status if ( not messages ) else 'error' ) #NEWLINE# error_msg = ( '\n' . join ( messages ) if messages else error_msg ) #NEWLINE# logger . debug ( 'Check dhcp message %s' , error_msg ) #NEWLINE# task = objects . Task . get_by_uuid ( task_uuid , fail_if_not_found = True ) #NEWLINE# objects . Task . update_verify_networks ( task , status , progress , error_msg , result )