Revision 054a9d17 lib/cmdlib/test.py

b/lib/cmdlib/test.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
53 53

  
54 54
    """
55 55
    self.needed_locks = {}
56

  
57
    if self.op.on_nodes or self.op.on_master:
58
      self.needed_locks[locking.LEVEL_NODE] = []
59

  
56 60
    if self.op.on_nodes:
57 61
      # _GetWantedNodes can be used here, but is not always appropriate to use
58 62
      # this way in ExpandNames. Check LogicalUnit.ExpandNames docstring for
59 63
      # more information.
60 64
      self.op.on_nodes = GetWantedNodes(self, self.op.on_nodes)
61
      self.needed_locks[locking.LEVEL_NODE] = self.op.on_nodes
65
      self.needed_locks[locking.LEVEL_NODE].extend(self.op.on_nodes)
66

  
67
    if self.op.on_master:
68
      # The node lock should be acquired for the master as well.
69
      self.needed_locks[locking.LEVEL_NODE].append(self.cfg.GetMasterNode())
62 70

  
63 71
  def _TestDelay(self):
64 72
    """Do the actual sleep.

Also available in: Unified diff