#NEWLINE# def inspect_hardware( self , task ) : #NEWLINE# #INDENT# "Inspect hardware to get the hardware properties.\n\n        Inspects hardware to get the essential and additional hardware\n        properties. It fails if any of the essential properties\n        are not received from the node.  It doesn't fail if node fails\n        to return any capabilities as the capabilities differ from hardware\n        to hardware mostly.\n\n        :param task: a TaskManager instance.\n        :raises: HardwareInspectionFailure if essential properties\n                 could not be retrieved successfully.\n        :raises: IloOperationError if system fails to get power state.\n        :returns: The resulting state of inspection.\n\n        " #NEWLINE# power_turned_on = False #NEWLINE# ilo_object = ilo_common . get_ilo_object ( node_properties . node ) #NEWLINE# try : #NEWLINE# #INDENT# state = task . driver . power . get_power_state ( task ) #NEWLINE# #UNINDENT# except exception . IloOperationError as ilo_exception : #NEWLINE# #INDENT# operation = ( _ ( 'Inspecting hardware (get_power_state) on %s' ) % task . node . uuid ) #NEWLINE# raise exception . IloOperationError ( operation = operation , error = ilo_exception ) #NEWLINE# #UNINDENT# if ( state != states . POWER_ON ) : #NEWLINE# #INDENT# LOG . info ( _LI ( 'The node %s is not powered on. Powering on the node for inspection.' ) , task . node . uuid ) #NEWLINE# conductor_utils . node_power_action ( task , states . POWER_ON ) #NEWLINE# power_turned_on = True #NEWLINE# #UNINDENT# inspected_properties = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# result = _get_essential_properties ( task . node , ilo_object ) #NEWLINE# properties = result [ 'properties' ] #NEWLINE# for known_property in self . ESSENTIAL_PROPERTIES : #NEWLINE# #INDENT# inspected_properties [ known_property ] = properties [ known_property ] #NEWLINE# #UNINDENT# node_properties = task . node . properties #NEWLINE# node_properties . update ( inspected_properties ) #NEWLINE# task . node . properties = node_properties #NEWLINE# capabilities = _get_capabilities ( task . node , ilo_object ) #NEWLINE# if capabilities : #NEWLINE# #INDENT# valid_cap = _create_supported_capabilities_dict ( capabilities ) #NEWLINE# capabilities = utils . get_updated_capabilities ( task . node . properties . get ( 'capabilities' ) , valid_cap ) #NEWLINE# if capabilities : #NEWLINE# #INDENT# node_properties [ 'capabilities' ] = capabilities #NEWLINE# task . node . properties = node_properties #NEWLINE# #UNINDENT# #UNINDENT# task . node . save ( ) #NEWLINE# _create_ports_if_not_exist ( task . node , result [ 'macs' ] ) #NEWLINE# LOG . debug ( 'Node properties for %(node)s are updated as %(properties)s' , { #NEWLINE# #INDENT# 'properties' : inspected_properties , #NEWLINE# 'node' : task . node . uuid , #NEWLINE# #UNINDENT# } ) #NEWLINE# LOG . info ( _LI ( 'Node %s inspected.' ) , task . node . uuid ) #NEWLINE# if power_turned_on : #NEWLINE# #INDENT# conductor_utils . node_power_action ( task , states . POWER_OFF ) #NEWLINE# LOG . info ( _LI ( 'The node %s was powered on for inspection. Powered off the node as inspection completed.' ) , task . node . uuid ) #NEWLINE# #UNINDENT# return states . MANAGEABLE