#NEWLINE# def _get_power_status( node ) : #NEWLINE# #INDENT# 'Get current power state of this node\n\n    :param node: Ironic node one of :class:`ironic.db.models.Node`\n    :raises: InvalidParameterValue if a seamicro parameter is invalid.\n    :raises: MissingParameterValue if required seamicro parameters are\n        missing.\n    :raises: ServiceUnavailable on an error from SeaMicro Client.\n    :returns: Power state of the given node\n    ' #NEWLINE# seamicro_info = _parse_driver_info ( node ) #NEWLINE# try : #NEWLINE# #INDENT# server = _get_server ( seamicro_info ) #NEWLINE# if ( ( not hasattr ( server , 'active' ) ) or ( server . active is None ) ) : #NEWLINE# #INDENT# return states . ERROR #NEWLINE# #UNINDENT# if ( not server . active ) : #NEWLINE# #INDENT# return states . POWER_OFF #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if server . active : #NEWLINE# #INDENT# return states . POWER_ON #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except seamicro_client_exception . NotFound : #NEWLINE# #INDENT# raise exception . NodeNotFound ( node = node . uuid ) #NEWLINE# #UNINDENT# except seamicro_client_exception . ClientException as ex : #NEWLINE# #INDENT# LOG . error ( _LE ( 'SeaMicro client exception %(msg)s for node %(uuid)s' ) , { #NEWLINE# #INDENT# 'msg' : ex . message , #NEWLINE# 'uuid' : node . uuid , #NEWLINE# #UNINDENT# } ) #NEWLINE# raise exception . ServiceUnavailable ( message = ex . message )