@@ -512,7 +512,14 @@ impl Spec {
512
512
let ( total_anchor_nodes, total_non_anchor_nodes) =
513
513
match constants:: NETWORK_ID_TO_NETWORK_NAME . get ( & network_id) {
514
514
// non-custom network only single node to utilize single AZ
515
- Some ( _) => ( None , 1 ) ,
515
+ Some ( _) => (
516
+ None ,
517
+ if opts. non_anchor_nodes > 0 {
518
+ opts. non_anchor_nodes
519
+ } else {
520
+ DEFAULT_MACHINE_NON_ANCHOR_NODES
521
+ } ,
522
+ ) ,
516
523
517
524
// custom network
518
525
None => {
@@ -1015,13 +1022,14 @@ impl Spec {
1015
1022
) ,
1016
1023
) ) ;
1017
1024
}
1018
- if !self . avalanchego_config . is_custom_network ( ) && self . machine . total_non_anchor_nodes != 1
1025
+ if self . avalanchego_config . is_custom_network ( )
1026
+ && self . machine . total_anchor_nodes . unwrap_or ( 0 ) == 0
1019
1027
{
1020
1028
return Err ( Error :: new (
1021
1029
ErrorKind :: InvalidInput ,
1022
1030
format ! (
1023
- "'machine.non_anchor_nodes ' must be 1 (set to {}) in order to maximize the benefit of static EBS provision per AZ " ,
1024
- self . machine. total_non_anchor_nodes
1031
+ "'machine.total_anchor_nodes ' must be > 1 (set to {:?}) " ,
1032
+ self . machine. total_anchor_nodes
1025
1033
) ,
1026
1034
) ) ;
1027
1035
}
@@ -1669,13 +1677,9 @@ pub const DEFAULT_MACHINE_ANCHOR_NODES: u32 = 1;
1669
1677
pub const MIN_MACHINE_ANCHOR_NODES : u32 = 1 ;
1670
1678
pub const MAX_MACHINE_ANCHOR_NODES : u32 = 100 ;
1671
1679
1672
- /// Default machine non-anchor nodes size.
1673
- /// "1" is better in order to choose only one AZ for static EBS provision.
1674
- /// If one wants to run multiple nodes, it should create multiple groups
1675
- /// of avalanche ops clusters.
1676
- pub const DEFAULT_MACHINE_NON_ANCHOR_NODES : u32 = 2 ;
1677
1680
pub const MIN_MACHINE_NON_ANCHOR_NODES : u32 = 1 ;
1678
1681
pub const MAX_MACHINE_NON_ANCHOR_NODES : u32 = 500 ;
1682
+ pub const DEFAULT_MACHINE_NON_ANCHOR_NODES : u32 = 1 ;
1679
1683
1680
1684
#[ derive( Debug , Serialize , Deserialize , Eq , PartialEq , Clone ) ]
1681
1685
#[ serde( rename_all = "snake_case" ) ]
0 commit comments