[DRBD-cvs] testing by lars; improvements to the CTH. will hopefully ...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Tue, 15 Jun 2004 10:41:07 +0200 (CEST)
DRBD CVS committal
Author : lars
Project : drbd
Module : testing
Dir : drbd/testing/CTH/LGE_CTH
Modified Files:
Tag: rel-0_7-branch
DRBD_Resource.pm Disk.pm
Log Message:
improvements to the CTH. will hopefully work out of the box.
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/LGE_CTH/Attic/DRBD_Resource.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- DRBD_Resource.pm 27 May 2004 12:44:18 -0000 1.1.2.1
+++ DRBD_Resource.pm 15 Jun 2004 08:41:02 -0000 1.1.2.2
@@ -1,4 +1,4 @@
-# $Id: DRBD_Resource.pm,v 1.1.2.1 2004/05/27 12:44:18 lars Exp $
+# $Id: DRBD_Resource.pm,v 1.1.2.2 2004/06/15 08:41:02 lars Exp $
package LGE_CTH::DRBD_ResourceInstance;
use strict;
use warnings;
@@ -25,8 +25,7 @@
role => [ qw(active passive) ],
data => [ qw(valid inconsistent) ],
disk => [ qw(attached detached) ],
- # keep these state names,
- # for now I depend on the sort order! (I think. Do I, still?)
+ # keep these state names, I may depend on the sort order!
conn => [ qw(Alone Try connected syncSource syncTarget) ],
},
);
@@ -137,6 +136,7 @@
name => undef,
minor => undef,
protocol => 'C', # A,B,C
+ usize => 0,
'incon-degr-cmd' => "reboot -f",
startup => {
'degr-wfc-timeout' => 120, # 2 minutes.
@@ -198,6 +198,7 @@
name => $c->{name},
dev => $lodev,
may_fail => \$n->{lo_may_fail},
+ usize => ($c->{usize} ? ($c->{usize}+128) : 0)
};
my $instance = new LGE_CTH::DRBD_ResourceInstance {
master_resource => $me,
@@ -254,21 +255,25 @@
# FIXME paranoia: $node in peers, and up...
my ($minor,$name) = @{$me->{_config}}{qw( minor name )};
my ($hostname,$ip) = @{$node->{_config}}{qw/hostname admin_ip/};
- my $cmd;
+ my ($cmd,$force);
if ($me->{_config}->{do_once_per_node} and not $me->{"did_once:$node->{_id}"}++) {
$cmd = "on $ip: $me->{_config}->{do_once_per_node} " . $me->env;
_spawn("$me->{_id} do once per node on $node->{_id}", $cmd, 'SYNC');
}
- if ($me->{_config}->{do_on_first_start} and not $me->{did_on_first_start}++) {
- $cmd = "on $ip: $me->{_config}->{do_on_first_start} " . $me->env;
- _spawn("$me->{_id} do on first start on $node->{_id}", $cmd, 'SYNC') if $cmd;
+ if (not $me->{did_on_first_start}++) {
+ if ($me->{_config}->{do_on_first_start}) {
+ $cmd = "on $ip: $me->{_config}->{do_on_first_start} " . $me->env;
+ _spawn("$me->{_id} do on first start on $node->{_id}", $cmd, 'SYNC') if $cmd;
+ }
+ $force = 1;
}
$cmd = "on $ip: drbd_wait_peer_not_pri minor=$minor";
_spawn("$me->{_id}: wait for $hostname to recognize ... ",$cmd,'SYNC');
$cmd = "on $ip: drbdadm_pri name=$name";
+ $cmd .= ' "force=-- -d"' if $force;
_spawn("$me->{_id}: Primary $name on $node->{_config}->{hostname}",$cmd,'SYNC');
}
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/LGE_CTH/Attic/Disk.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- Disk.pm 27 May 2004 12:44:18 -0000 1.1.2.1
+++ Disk.pm 15 Jun 2004 08:41:02 -0000 1.1.2.2
@@ -1,5 +1,5 @@
package LGE_CTH::Disk;
-# $Id: Disk.pm,v 1.1.2.1 2004/05/27 12:44:18 lars Exp $
+# $Id: Disk.pm,v 1.1.2.2 2004/06/15 08:41:02 lars Exp $
use strict;
use warnings;
@@ -24,6 +24,7 @@
dev => undef,
name => undef,
may_fail => 0,
+ usize => 0,
setup_script => 'empty_script',
heal_script => 'dmsetup_linear',
fail_script => 'dmsetup_error',
@@ -80,29 +81,32 @@
sub fail {
my $me = shift;
- my ($dev,$name,$node) = @{$me->{_config}}{qw(dev name node)};
+ my ($dev,$name,$node,$usize) = @{$me->{_config}}{qw(dev name node usize)};
my ($hostname,$admin_ip) = @{$node->{_config}}{qw(hostname admin_ip)};
- my $cmd = "on $admin_ip: dmsetup_error name=$name dev=$dev\n";
+ my $blocks = $usize ? ( "blocks=" . ($usize*1024) ) : "";
+ my $cmd = "on $admin_ip: dmsetup_error name=$name dev=$dev $blocks\n";
$me->_generic_event("fail","down",$cmd);
}
sub heal {
my $me = shift;
- my ($dev,$name,$node) = @{$me->{_config}}{qw(dev name node)};
+ my ($dev,$name,$node,$usize) = @{$me->{_config}}{qw(dev name node usize)};
my ($hostname,$admin_ip) = @{$node->{_config}}{qw(hostname admin_ip)};
- my $cmd = "on $admin_ip: dmsetup_linear name=$name dev=$dev\n";
+ my $blocks = $usize ? ( "blocks=" . ($usize*1024) ) : "";
+ my $cmd = "on $admin_ip: dmsetup_linear name=$name dev=$dev $blocks\n";
$me->_generic_event("heal","up",$cmd);
}
sub reconfigure {
my $me = shift;
- my ($dev,$name,$node) = @{$me->{_config}}{qw(dev name node)};
+ my ($dev,$name,$node,$usize) = @{$me->{_config}}{qw(dev name node usize)};
my ($hostname,$admin_ip) = @{$node->{_config}}{qw(hostname admin_ip)};
+ my $blocks = $usize ? ( "blocks=" . ($usize*1024) ) : "";
my $cmd;
if ($me->{_status}->{status} eq 'down') {
- $cmd = "on $admin_ip: dmsetup_error name=$name dev=$dev\n";
+ $cmd = "on $admin_ip: dmsetup_error name=$name dev=$dev $blocks\n";
} else {
- $cmd = "on $admin_ip: dmsetup_linear name=$name dev=$dev\n";
+ $cmd = "on $admin_ip: dmsetup_linear name=$name dev=$dev $blocks\n";
}
_spawn( "configure $dev as $name on $hostname after boot", $cmd, 'SYNC');
}