]> git.proxmox.com Git - pve-storage.git/commitdiff
drbd: correctly wait for diskless assignments
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 18 Jun 2015 04:27:19 +0000 (06:27 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 18 Jun 2015 08:43:43 +0000 (10:43 +0200)
PVE/Storage/DRBDPlugin.pm

index 91ff8426f748649e33c869f7aa7320bafe4cf587..8717f904f516de8acbaa16d4caad52904287c00f 100644 (file)
@@ -315,18 +315,20 @@ sub activate_volume {
     ($rc, $res) = $hdl->assign($nodename, $volname, { diskless => 'true' });
     check_drbd_rc($rc->[0]);
 
-    # fixme: wait until device is acessible - looks strange to me ?
-
+    # wait until device is acessitble
     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;
+       ($rc, $res) = $hdl->list_assignments([$nodename], [$volname], 0, { "cstate:deploy" => "true" }, []);
+       check_drbd_rc($rc->[0]);
+       my $len = scalar(@$res);
+       last if $len > 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;    
 }