From b07cbac476fff48d4f41d9ceaf965aeee5a42de5 Mon Sep 17 00:00:00 2001 From: John Schmerge Date: Thu, 31 Mar 2016 18:49:56 -0400 Subject: [PATCH 1/3] Always insert a 'volume=x' parameter into storage.config ATS has an issue where it cannot figure out what volume to assign to a replacement drive if other drives already have an existing volume assignment. Explicitly setting the volume parameter for every drive in storage.config works around this issue. --- traffic_ops/app/lib/UI/ConfigFiles.pm | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/traffic_ops/app/lib/UI/ConfigFiles.pm b/traffic_ops/app/lib/UI/ConfigFiles.pm index ae2e270af..4ce833fec 100644 --- a/traffic_ops/app/lib/UI/ConfigFiles.pm +++ b/traffic_ops/app/lib/UI/ConfigFiles.pm @@ -815,15 +815,12 @@ sub storage_dot_config_volume_text { my $prefix = shift; my $letters = shift; my $volume = shift; - my $has_multiple_volumes = shift; my $text = ""; my @postfix = split( /,/, $letters ); foreach my $l ( sort @postfix ) { $text .= $prefix . $l; - if ($has_multiple_volumes) { - $text .= " volume=" . $volume; - } + $text .= " volume=" . $volume; $text .= "\n"; } return $text; @@ -838,24 +835,34 @@ sub storage_dot_config { my $text = $self->header_comment( $server->host_name ); my $data = $self->param_data( $server, $file ); - my $has_multiple_volumes = get_num_volumes($data) > 1; + # always default to volume one and let DB params override + my $assigned_volume = 1; if ( defined( $data->{Drive_Prefix} ) ) { + if ( defined($data->{Disk_Volume} ) ) { + $assigned_volume = $data->{Disk_Volume}; + } $text .= storage_dot_config_volume_text( $data->{Drive_Prefix}, $data->{Drive_Letters}, - $data->{Disk_Volume}, $has_multiple_volumes + $assigned_volume ); } if ( defined( $data->{RAM_Drive_Prefix} ) ) { + if ( defined($data->{RAM_Volume} ) ) { + $assigned_volume = $data->{RAM_Volume}; + } $text .= storage_dot_config_volume_text( $data->{RAM_Drive_Prefix}, $data->{RAM_Drive_Letters}, - $data->{RAM_Volume}, $has_multiple_volumes + $data->{RAM_Volume} ); } if ( defined( $data->{SSD_Drive_Prefix} ) ) { + if ( defined($data->{SSD_Volume} ) ) { + $assigned_volume = $data->{SSD_Volume}; + } $text .= storage_dot_config_volume_text( $data->{SSD_Drive_Prefix}, $data->{SSD_Drive_Letters}, - $data->{SSD_Volume}, $has_multiple_volumes + $data->{SSD_Volume} ); } return $text; From 15fdc8cbb886bc4411c3f6fb0426def06a27d1b2 Mon Sep 17 00:00:00 2001 From: John Schmerge Date: Tue, 5 Apr 2016 11:07:39 -0400 Subject: [PATCH 2/3] Address a few concerns about the default mixing up volume defaults I'm not sure that this change does anything unless you make changes to the TO Db that the UI would never make. --- traffic_ops/app/lib/UI/ConfigFiles.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/traffic_ops/app/lib/UI/ConfigFiles.pm b/traffic_ops/app/lib/UI/ConfigFiles.pm index 4ce833fec..8f36b2d21 100644 --- a/traffic_ops/app/lib/UI/ConfigFiles.pm +++ b/traffic_ops/app/lib/UI/ConfigFiles.pm @@ -847,22 +847,30 @@ sub storage_dot_config { $assigned_volume ); } + + # Default to 2 here + $assigned_volume = 2; + if ( defined( $data->{RAM_Drive_Prefix} ) ) { if ( defined($data->{RAM_Volume} ) ) { $assigned_volume = $data->{RAM_Volume}; } $text .= storage_dot_config_volume_text( $data->{RAM_Drive_Prefix}, $data->{RAM_Drive_Letters}, - $data->{RAM_Volume} + $assigned_volume ); } + + # ...and default to 3 here + $assigned_volume = 3; + if ( defined( $data->{SSD_Drive_Prefix} ) ) { if ( defined($data->{SSD_Volume} ) ) { $assigned_volume = $data->{SSD_Volume}; } $text .= storage_dot_config_volume_text( $data->{SSD_Drive_Prefix}, $data->{SSD_Drive_Letters}, - $data->{SSD_Volume} + $assigned_volume ); } return $text; From 4024ab9035f3dc33798d9f53f01f145981e9f95a Mon Sep 17 00:00:00 2001 From: John Schmerge Date: Tue, 5 Apr 2016 12:55:34 -0400 Subject: [PATCH 3/3] More edge cases addressed. --- traffic_ops/app/lib/UI/ConfigFiles.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/traffic_ops/app/lib/UI/ConfigFiles.pm b/traffic_ops/app/lib/UI/ConfigFiles.pm index 8f36b2d21..3fbc7fffe 100644 --- a/traffic_ops/app/lib/UI/ConfigFiles.pm +++ b/traffic_ops/app/lib/UI/ConfigFiles.pm @@ -848,10 +848,9 @@ sub storage_dot_config { ); } - # Default to 2 here - $assigned_volume = 2; - if ( defined( $data->{RAM_Drive_Prefix} ) ) { + ++$assigned_volume; + if ( defined($data->{RAM_Volume} ) ) { $assigned_volume = $data->{RAM_Volume}; } @@ -861,10 +860,10 @@ sub storage_dot_config { ); } - # ...and default to 3 here - $assigned_volume = 3; if ( defined( $data->{SSD_Drive_Prefix} ) ) { + ++$assigned_volume; + if ( defined($data->{SSD_Volume} ) ) { $assigned_volume = $data->{SSD_Volume}; }