Revision fcad7225 lib/cmdlib.py

b/lib/cmdlib.py
1510 1510
      self.bad = self.bad or cond
1511 1511

  
1512 1512

  
1513
class LUClusterVerify(NoHooksLU):
1514
  """Submits all jobs necessary to verify the cluster.
1515

  
1516
  """
1517
  REQ_BGL = False
1518

  
1519
  def ExpandNames(self):
1520
    self.needed_locks = {}
1521

  
1522
  def Exec(self, feedback_fn):
1523
    jobs = []
1524

  
1525
    if self.op.group_name:
1526
      groups = [self.op.group_name]
1527
      depends_fn = lambda: None
1528
    else:
1529
      groups = self.cfg.GetNodeGroupList()
1530

  
1531
      # Verify global configuration
1532
      jobs.append([opcodes.OpClusterVerifyConfig()])
1533

  
1534
      # Always depend on global verification
1535
      depends_fn = lambda: [(-len(jobs), [])]
1536

  
1537
    jobs.extend([opcodes.OpClusterVerifyGroup(group_name=group,
1538
                                              depends=depends_fn())]
1539
                for group in groups)
1540

  
1541
    # Fix up all parameters
1542
    for op in itertools.chain(*jobs): # pylint: disable-msg=W0142
1543
      op.debug_simulate_errors = self.op.debug_simulate_errors
1544
      op.verbose = self.op.verbose
1545
      op.error_codes = self.op.error_codes
1546
      try:
1547
        op.skip_checks = self.op.skip_checks
1548
      except AttributeError:
1549
        assert not isinstance(op, opcodes.OpClusterVerifyGroup)
1550

  
1551
    return ResultWithJobs(jobs)
1552

  
1553

  
1513 1554
class LUClusterVerifyConfig(NoHooksLU, _VerifyErrors):
1514 1555
  """Verifies the cluster config.
1515 1556

  

Also available in: Unified diff