diff --git a/mxmirror/mxmirror b/mxmirror/mxmirror index 9cefbdb..643c94d 100755 --- a/mxmirror/mxmirror +++ b/mxmirror/mxmirror @@ -42,8 +42,6 @@ my $hostip = inet_ntoa(scalar gethostbyname($fullhostname)); my $jbodmap = read_jbodmap($JBODMAP); my $mirrors = read_mirrormap($MIRRORMAP); -#my $timeslots = CalcTimeslots($mirrors); -my $timeslots; #print Dumper GroupMirrors($mirrors); @@ -306,10 +304,6 @@ sub check_a { } -#print Dumper $timeslots; -#exit; - - #print Dumper $mirrors; my $result = GetOptions( @@ -370,7 +364,7 @@ if(defined $opt{sourcehosts}) { } if(defined $opt{all}) { - exit print_and_exec_all($mirrors, $timeslots); + exit print_and_exec_all($mirrors); } @@ -434,7 +428,6 @@ exit($err); sub print_and_exec_all { my $list = shift; - my $ts = shift; my $default_fmt = "SRCHOST:SRCPATH DSTHOST:DSTPATH ARGS"; my $fmt = (defined $opt{format})?$opt{format}:$default_fmt; @@ -464,7 +457,6 @@ sub print_and_exec_all { foreach my $h (@hosts) { my %vars = ( -# TIME => $ts->{hosts}->{$h}->{time_str} ); foreach(@{$list->{$h}}) { @@ -1022,67 +1014,3 @@ sub ParseTime { warn "ParseTime invalid time '$s'"; return [0,0]; } - - - -sub CalcTimeslots { - my $list = shift; - - my @hosts = sort keys %{$list}; - - my $ts = {}; - my $t1 = ParseTime($CONFIG{START}); - my $t2 = ParseTime($CONFIG{END}); - my $step = ParseTime($CONFIG{STEP}); - - my $dt = DeltaTime($t1, $t2); - - my $s = TimeToSeconds($step); - my $dspan = SecondsToTime($s/2); - - $ts->{nslots} = int(TimeToSeconds($dt) / $s)+1; - $ts->{start} = $t1; - $ts->{end} = $t2; - $ts->{step} = $step; - $ts->{slots} = []; - $ts->{hosts} = {}; - - my $this = $ts->{start}; - - my $i = 0; - while($i++ < $ts->{nslots}) { - my $slot = {}; - - $slot->{time} = $this; - $slot->{timespan}->[0] = SubDeltaTime($this, $dspan); - $slot->{timespan}->[1] = AddDeltaTime($this, $dspan); - $slot->{time_str} = FormatTime($this); - - push @{$ts->{slots}}, $slot; - - $this = AddDeltaTime($this, $step); - } - - - $i = 0; - - foreach my $host (@hosts) { - my $slot = $ts->{slots}->[$i++ % $ts->{nslots}]; - - foreach(@{$list->{$host}}) { - $_->{timeslot} = $slot; - } - } - - return $ts; -} - - - -# read jbod map - -#eval $(cat /etc/amd/amd.jbod | sed -ne 's,^.*/amd/\(.*\)/X/\(X....\).*$,\2=\1,p') - - - -