From 98e250aa41cda1c18a59880b7d6f04873085c0d3 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 17 Jun 2015 11:23:52 +0200 Subject: [PATCH] drbd: call set_drbdsetup_props after auto-deploy Else it gets not assigned. For some unknown reason, we need to sleep to avoid a split brain?! --- PVE/Storage/DRBDPlugin.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/PVE/Storage/DRBDPlugin.pm b/PVE/Storage/DRBDPlugin.pm index ca80036..e1d6a60 100644 --- a/PVE/Storage/DRBDPlugin.pm +++ b/PVE/Storage/DRBDPlugin.pm @@ -180,15 +180,6 @@ sub alloc_image { my ($rc, $res) = $hdl->create_resource($name, {}); check_drbd_rc($rc->[0]); - ($rc, $res) = $hdl->set_drbdsetup_props( - { - target => "resource", - resource => $name, - type => 'neto', - 'allow-two-primaries' => 'yes', - }); - check_drbd_rc($rc->[0]); - ($rc, $res) = $hdl->create_volume($name, $size, {}); check_drbd_rc($rc->[0]); @@ -197,6 +188,17 @@ sub alloc_image { ($rc, $res) = $hdl->auto_deploy($name, $redundancy, 0, 0); check_drbd_rc($rc->[0]); + sleep(5); # else we get split brain?! + + ($rc, $res) = $hdl->set_drbdsetup_props( + { + target => "resource", + resource => $name, + type => 'neto', + 'allow-two-primaries' => 'yes', + }); + check_drbd_rc($rc->[0]); + return $name; } -- 2.39.2