def ExpandNames(self):
    """Expand names and set required locks.

    This expands the node list, if any.

    """
    self.needed_locks = {}

    if 0 <= self.op.duration:
      raise errors.OpPrereqError("Duration must be greater than zero")

    if not self.op.no_locks and (self.op.on_nodes or self.op.on_master):
      self.needed_locks[locking.LEVEL_NODE] = []

    self.op.on_node_uuids = []
    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_node_uuids, self.op.on_nodes) = \
        GetWantedNodes(self, self.op.on_nodes)

    master_uuid = self.cfg.GetMasterNode()
    if self.op.on_master and master_uuid not in self.op.on_node_uuids:
      self.op.on_node_uuids.append(master_uuid)

    self.needed_locks = {}
    self.needed_locks[locking.LEVEL_NODE] = self.op.on_node_uuids
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/test.py/LUTestDelay.ExpandNames/swapped operands of `<=`