Revision 97c61d46 lib/cmdlib.py

b/lib/cmdlib.py
2499 2499
    """
2500 2500
    node = self.node = self.cfg.GetNodeInfo(self.op.node_name)
2501 2501

  
2502
    if (self.op.master_candidate is not None or
2503
        self.op.drained is not None or
2504
        self.op.offline is not None):
2505
      # we can't change the master's node flags
2506
      if self.op.node_name == self.cfg.GetMasterNode():
2507
        raise errors.OpPrereqError("The master role can be changed"
2508
                                   " only via masterfailover")
2509

  
2502 2510
    if ((self.op.master_candidate == False or self.op.offline == True or
2503 2511
         self.op.drained == True) and node.master_candidate):
2504
      # we will demote the node from master_candidate
2505
      if self.op.node_name == self.cfg.GetMasterNode():
2506
        raise errors.OpPrereqError("The master node has to be a"
2507
                                   " master candidate, online and not drained")
2508 2512
      cp_size = self.cfg.GetClusterInfo().candidate_pool_size
2509 2513
      num_candidates, _ = self.cfg.GetMasterCandidateStats()
2510 2514
      if num_candidates <= cp_size:

Also available in: Unified diff