From 466183d6773b2bcc61dd6d6970be2658ceebe046 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 23 Mar 2015 12:50:13 +0100 Subject: [PATCH] DRBDPlugin: hack - wait until device is acessible --- PVE/Storage/DRBDPlugin.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/PVE/Storage/DRBDPlugin.pm b/PVE/Storage/DRBDPlugin.pm index dbeff45..ddc86f6 100644 --- a/PVE/Storage/DRBDPlugin.pm +++ b/PVE/Storage/DRBDPlugin.pm @@ -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; }