Commit 054a9d17 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic

Add correct locking of master node to gnt-debug delay

The gnt-debug delay command required locks for all nodes except the
master - this patch fixes the issue by adding master to the locks
whenever needed.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 95a4e33f
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -53,12 +53,20 @@ class LUTestDelay(NoHooksLU):
"""
self.needed_locks = {}
if self.op.on_nodes or self.op.on_master:
self.needed_locks[locking.LEVEL_NODE] = []
if self.op.on_nodes:
# _GetWantedNodes can be used here, but is not always appropriate to use
# this way in ExpandNames. Check LogicalUnit.ExpandNames docstring for
# more information.
self.op.on_nodes = GetWantedNodes(self, self.op.on_nodes)
self.needed_locks[locking.LEVEL_NODE] = self.op.on_nodes
self.needed_locks[locking.LEVEL_NODE].extend(self.op.on_nodes)
if self.op.on_master:
# The node lock should be acquired for the master as well.
self.needed_locks[locking.LEVEL_NODE].append(self.cfg.GetMasterNode())
def _TestDelay(self):
"""Do the actual sleep.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment