#NEWLINE# def validate( self , cluster_spec , cluster ) : #NEWLINE# #INDENT# nn_count = cluster_spec . get_deployed_node_group_count ( 'NAMENODE' ) #NEWLINE# jn_count = cluster_spec . get_deployed_node_group_count ( 'JOURNALNODE' ) #NEWLINE# zkfc_count = cluster_spec . get_deployed_node_group_count ( 'ZKFC' ) #NEWLINE# if cluster_spec . is_hdfs_ha_enabled ( cluster ) : #NEWLINE# #INDENT# if ( nn_count != 2 ) : #NEWLINE# #INDENT# raise ex . NameNodeHAConfigurationError ( ( 'Hadoop cluster with HDFS HA enabled requires 2 NAMENODE. Actual NAMENODE count is %s' % nn_count ) ) #NEWLINE# #UNINDENT# if ( not ( ( jn_count >= 3 ) and ( ( jn_count % 2 ) == 1 ) ) ) : #NEWLINE# #INDENT# raise ex . NameNodeHAConfigurationError ( ( 'JOURNALNODE count should be an odd number greater than or equal 3 for NameNode High Availability. Actual JOURNALNODE count is %s' % jn_count ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( nn_count != 1 ) : #NEWLINE# #INDENT# raise ex . InvalidComponentCountException ( 'NAMENODE' , 1 , nn_count ) #NEWLINE# #UNINDENT# if ( jn_count > 0 ) : #NEWLINE# #INDENT# raise ex . NameNodeHAConfigurationError ( 'JOURNALNODE can only be added when NameNode High Availability is enabled.' ) #NEWLINE# #UNINDENT# if ( cluster_spec > 0 ) : #NEWLINE# #INDENT# raise ex . NameNodeHAConfigurationError ( 'ZKFC can only be added when NameNode High Availability is enabled.' )