DRBDPlugin: hack - wait until device is acessible

This commit is contained in:
Dietmar Maurer
2015-03-23 12:50:13 +01:00
parent 28d5851293
commit 466183d677

View File

@ -292,7 +292,19 @@ sub activate_volume {
# create diskless assignment
($rc, $res) = $hdl->assign($nodename, $volname, { diskless => 'true' });
check_drbd_rc($rc->[0]);
# fixme: wait until device is acessible - looks strange to me ?
my $print_warning = 1;
my $max_wait_time = 20;
for (my $i = 0;; $i++) {
last if system("dd if=$path of=/dev/null bs=512 count=1 >/dev/null 2>&1") == 0;
die "aborting wait - device '$path' still not readable\n" if $i > $max_wait_time;
print "waiting for device '$path' to become ready...\n" if $print_warning;
$print_warning = 0;
sleep(1);
}
return undef;
}