In opportunistic locking, we always ask for as many locks
as possible to later chose what fits best. However, we
may also ask for a minimum as otherwise it cannot work
for principle reasons. For DRBD, this minimum should
be two, rather than the default one.

Signed-off-by: Klaus Aehlig <[email protected]>
Reviewed-by: Hrvoje Ribicic <[email protected]>

Cherry-picked from ed94242fdd9947815c84de8b0727aa63630c8f34.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/cmdlib/instance.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
index 3a3937b..514b72d 100644
--- a/lib/cmdlib/instance.py
+++ b/lib/cmdlib/instance.py
@@ -593,6 +593,9 @@ class LUInstanceCreate(LogicalUnit):
       if self.op.opportunistic_locking:
         self.opportunistic_locks[locking.LEVEL_NODE] = True
         self.opportunistic_locks[locking.LEVEL_NODE_RES] = True
+        if self.op.disk_template == constants.DT_DRBD8:
+          self.opportunistic_locks_count[locking.LEVEL_NODE] = 2
+          self.opportunistic_locks_count[locking.LEVEL_NODE_RES] = 2
     else:
       (self.op.pnode_uuid, self.op.pnode) = \
         ExpandNodeUuidAndName(self.cfg, self.op.pnode_uuid, self.op.pnode)
-- 
2.0.0.526.g5318336

Reply via email to