You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/03/09 19:09:40 UTC

[32/44] incubator-trafficcontrol git commit: Add ATS 6.2 support. Finally!

Add ATS 6.2 support. Finally!


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8a430221
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8a430221
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8a430221

Branch: refs/heads/master
Commit: 8a430221c608f1dbc244481ed979b7b8bab33e02
Parents: f0b9d96
Author: Jan van Doorn <jv...@apache.org>
Authored: Mon Feb 13 00:34:26 2017 +0000
Committer: Jan van Doorn <jv...@apache.org>
Committed: Fri Feb 17 17:49:11 2017 +0000

----------------------------------------------------------------------
 traffic_ops/app/lib/UI/ConfigFiles.pm | 43 +++++++++++++++++-------------
 1 file changed, 25 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8a430221/traffic_ops/app/lib/UI/ConfigFiles.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/ConfigFiles.pm b/traffic_ops/app/lib/UI/ConfigFiles.pm
index 7154b56..12c64fb 100644
--- a/traffic_ops/app/lib/UI/ConfigFiles.pm
+++ b/traffic_ops/app/lib/UI/ConfigFiles.pm
@@ -1094,7 +1094,12 @@ sub parent_dot_config {
 	my $server      = $self->server_data($id);
 	my $server_type = $server->type->name;
 
-	#my $parent_qstring;
+	my $ats_ver =
+		$self->db->resultset('ProfileParameter')
+		->search( { 'parameter.name' => 'trafficserver', 'parameter.config_file' => 'package', 'profile.id' => $server->profile->id },
+		{ prefetch => [ 'profile', 'parameter' ] } )->get_column('parameter.value')->single();
+	my $ats_major_version = substr( $ats_ver, 0, 1 );
+
 	my $pinfo;
 	my $text = $self->header_comment( $server->host_name );
 	if ( !defined($data) ) {
@@ -1106,21 +1111,17 @@ sub parent_dot_config {
 	if ( $server_type =~ m/^MID/ ) {
 		my @unique_origin;
 		foreach my $ds ( @{ $data->{dslist} } ) {
-			my $xml_id                           = $ds->{ds_xml_id};
-			my $os                               = $ds->{origin_shield};
-			my $multi_site_origin                = defined( $ds->{multi_site_origin} ) ? $ds->{multi_site_origin} : 0;
-			my $msoa                             = $ds->{'param'}->{'parent.config'}->{'mso.algorithm'};
-			my $mso_algorithm                    = defined($msoa) ? $msoa : 0;
-			my $dsre                             = $ds->{'param'}->{'parent.config'}->{'mso.dead_server_retry_enabled'};
-			my $dead_server_retry_enabled        = defined($dsre) ? $dsre : 0;
-			my $sre                              = $ds->{'param'}->{'parent.config'}->{'mso.simple_retry_enabled'};
-			my $simple_retry_enabled             = defined($sre) ? $sre : 0;
-			my $srsc                             = $ds->{'param'}->{'parent.config'}->{'mso.simple_retry_response_codes'};
-			my $simple_retry_response_codes      = defined($srsc) ? $srsc : "";
-			my $dsrrc                            = $ds->{'param'}->{'parent.config'}->{'mso.dead_server_retry_response_codes'};
-			my $dead_server_retry_response_codes = defined($dsrrc) ? $dsrrc : "";
-			my $qsh                              = $ds->{'param'}->{'parent.config'}->{'mso.qstring_handling'};
-			my $parent_qstring                   = "ignore"; # default is ignore, unless for alg consistent_hash
+			my $xml_id                             = $ds->{ds_xml_id};
+			my $os                                 = $ds->{origin_shield};
+			my $multi_site_origin                  = $ds->{multi_site_origin} || 0;
+			my $mso_algorithm                      = $ds->{'param'}->{'parent.config'}->{'mso.algorithm'} || 0;
+			my $parent_retry                       = $ds->{'param'}->{'parent.config'}->{'mso.parent_retry'};
+			my $unavailable_server_retry_responses = $ds->{'param'}->{'parent.config'}->{'mso.unavailable_server_retry_responses'};
+			my $max_simple_retries                 = $ds->{'param'}->{'parent.config'}->{'mso.max_simple_retries'} || 1;
+			my $max_unavailable_server_retries     = $ds->{'param'}->{'parent.config'}->{'mso.max_unavailable_server_retries'} || 1;
+
+			my $qsh            = $ds->{'param'}->{'parent.config'}->{'mso.qstring_handling'};
+			my $parent_qstring = "ignore";                                                      # default is ignore, unless for alg consistent_hash
 			if ( !defined($qsh) && $mso_algorithm eq 'consistent_hash' && $ds->{qstring_ignore} == 0 ) {
 				$parent_qstring = 'consider';
 			}
@@ -1181,12 +1182,18 @@ sub parent_dot_config {
 				}
 				my $parents = 'parent="' . join( '', @parent_info ) . '' . join( '', @secondary_parent_info ) . '' . join( '', @null_parent_info ) . '"';
 
-				$text .= "$parents round_robin=$mso_algorithm qstring=$parent_qstring go_direct=false parent_is_proxy=false\n";
+				$text .= "$parents round_robin=$mso_algorithm qstring=$parent_qstring go_direct=false parent_is_proxy=false";
+
+				if ( $ats_major_version >= 6 && $parent_retry ne "" ) {
+					$text .= " parent_retry=$parent_retry unavailable_server_retry_responses=$unavailable_server_retry_responses";
+					$text .= " max_simple_retries=$max_simple_retries max_unavailable_server_retries=$max_unavailable_server_retries";
+				} 
+				$text .= "\n";
 			}
 		}
 
 		#$text .= "dest_domain=. go_direct=true\n"; # this is implicit.
-		$self->app->log->debug( "MID PARENT.CONFIG:\n" . $text . "\n" );
+		#$self->app->log->debug( "MID PARENT.CONFIG:\n" . $text . "\n" );
 		return $text;
 	}
 	else {    #"True" Parent - we are genning a EDGE config that points to a parent proxy.