diff --git a/lib/cmdlib.py b/lib/cmdlib.py index d5731ace2332012c048e60ed1bf24f5f9958c57e..be4ccddae00956d84f52a4683c3a1a17c7375ee0 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3703,6 +3703,8 @@ class LUAddNode(LogicalUnit): primary_ip=primary_ip, secondary_ip=secondary_ip, master_candidate=self.master_candidate, + master_capable=True, + vm_capable=True, offline=False, drained=False, group=node_group) diff --git a/lib/config.py b/lib/config.py index 3276795f198b98e369035d9f9b30f663d74d9e4c..ef37882e597c0dc9020fbdd7687961a1d85b9820 100644 --- a/lib/config.py +++ b/lib/config.py @@ -1198,7 +1198,7 @@ class ConfigWriter: for node in self._config_data.nodes.values(): if exceptions and node.name in exceptions: continue - if not (node.offline or node.drained): + if not (node.offline or node.drained) and node.master_capable: mc_max += 1 if node.master_candidate: mc_now += 1 @@ -1239,7 +1239,7 @@ class ConfigWriter: break node = self._config_data.nodes[name] if (node.master_candidate or node.offline or node.drained or - node.name in exceptions): + node.name in exceptions or not node.master_capable): continue mod_list.append(node) node.master_candidate = True diff --git a/lib/objects.py b/lib/objects.py index 4bdd245bbe59bf6ade7c08004ce688ea9740d11e..768bf99de99e03583732125b046ad6986c9d85a5 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -940,8 +940,22 @@ class Node(TaggableObject): "offline", "drained", "group", + "master_capable", + "vm_capable", ] + _TIMESTAMPS + _UUID + def UpgradeConfig(self): + """Fill defaults for missing configuration values. + + """ + # pylint: disable-msg=E0203 + # because these are "defined" via slots, not manually + if self.master_capable is None: + self.master_capable = True + + if self.vm_capable is None: + self.vm_capable = True + class NodeGroup(ConfigObject): """Config object representing a node group."""