Commit 490acd18 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add the master/vm_capable flags to objects



This adds the flag and some initial handling. The rest of the changes,
for cmdlib, come in a separate patch.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 21232d04
......@@ -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)
......
......@@ -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
......
......@@ -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."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment