public boolean isRegisterable ( InstanceInfo instanceInfo ) { DataCenterInfo datacenterInfo = instanceInfo . getDataCenterInfo ( ) ; String serverRegion = clientConfig . getRegion ( ) ; if ( AmazonInfo . class . isInstance ( datacenterInfo ) ) { AmazonInfo info = AmazonInfo . class . cast ( instanceInfo . getDataCenterInfo ( ) ) ; String availabilityZone = info . get ( MetaDataKey . availabilityZone ) ; // Can be null for dev environments in non-AWS data center if ( availabilityZone == null && US_EAST_1 . equalsIgnoreCase ( serverRegion ) ) { return true ; } else if ( ( availabilityZone != null ) && ( availabilityZone . contains ( serverRegion ) ) ) { // If in the same region as server, then consider it registerable return true ; } } return true ; // Everything non-amazon is registrable. }
Checks if an instance is registerable in this region . Instances from other regions are rejected .