diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index fbb4cb9a23831ddf07bb14aa32f9e33fd9cd034b..8771f66ffd90337fd901dab15c62b4c1f748b506 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1950,9 +1950,16 @@ class LUAddNode(LogicalUnit):
         raise errors.OpPrereqError("Node secondary ip not reachable by TCP"
                                    " based ping to noded port")
 
+    cp_size = self.cfg.GetClusterInfo().candidate_pool_size
+    node_info = self.cfg.GetAllNodesInfo().values()
+    num_candidates = len([n for n in node_info
+                          if n.master_candidate])
+    master_candidate = num_candidates < cp_size
+
     self.new_node = objects.Node(name=node,
                                  primary_ip=primary_ip,
-                                 secondary_ip=secondary_ip)
+                                 secondary_ip=secondary_ip,
+                                 master_candidate=master_candidate)
 
   def Exec(self, feedback_fn):
     """Adds the new node to the cluster.