~vcs-imports/mysql-mmm/2.0

« back to all changes in this revision

Viewing changes to lib/Monitor/Roles.pm

  • Committer: mail at pascalhofmann
  • Date: 2009-02-05 09:34:25 UTC
  • Revision ID: vcs-imports@canonical.com-20090205093425-kc4rq5hdbtj6t885
ph:
- Removed may_get_flapping-stuff from preferred host handling
- Removed some notes
- Deny move_role if the role is assigned to the preferred host
- Removed bad log messages about agent availability.
- ignore replication fail for 60 seconds (default value of master-connect-retry) after peer host went back online.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
}
172
172
 
173
173
 
 
174
=item assigned_to_preferred_host($role)
 
175
 
 
176
Check if role is assigned to preferred host
 
177
 
 
178
=cut
 
179
 
 
180
sub assigned_to_preferred_host($$) {
 
181
        my $self        = shift;
 
182
        my $role        = shift;
 
183
 
 
184
        my $role_info = $self->{$role};
 
185
        return undef unless $role_info;
 
186
        return undef unless ($role_info->{prefer});
 
187
 
 
188
        my @ips = keys( %{ $role_info->{ips} } );
 
189
        return ($role_info->{ips}->{$ips[0]}->{assigned_to} eq $role_info->{prefer});
 
190
        
 
191
}
 
192
 
 
193
 
174
194
=item clear_host_roles($host)
175
195
 
176
196
Remove all roles from host $host.
307
327
 
308
328
                next unless ($agents->{$host}->state eq 'ONLINE');
309
329
                next if ($agents->{$host}->agent_down);
310
 
                next if ($agents->{$host}->may_get_flapping);
311
330
 
312
 
                my $ip                  = $self->get_exclusive_role_ip($role);
 
331
                my @ips                 = keys( %{ $role_info->{ips} } );
 
332
                my $ip                  = $ips[0];
313
333
                my $ip_info             = $role_info->{ips}->{$ip};
314
334
                my $old_host    = $ip_info->{assigned_to};
315
335