Commit e1374a9e authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Use explicit configuration for nodes in GanetiContext

This way, each call to AddNode or RemoveNode uses a passed configuration
object that belongs to the appropriate job.

This is required to subsequently get rid of the single shared
ConfigWriter object.
Signed-off-by: default avatarPetr Pudlak <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 7a311c56
......@@ -415,7 +415,7 @@ class LUNodeAdd(LogicalUnit):
result.Warn("Node failed to demote itself from master candidate status",
self.context.AddNode(self.new_node, self.proc.GetECId())
self.context.AddNode(self.cfg, self.new_node, self.proc.GetECId())
# We create a new certificate even if the node is readded
......@@ -1478,7 +1478,7 @@ class LUNodeRemove(LogicalUnit):
# Promote nodes to master candidate as needed
AdjustCandidatePool(self, [self.node.uuid])
self.context.RemoveNode(self.cfg, self.node)
# Run post hooks on the node before it's removed
......@@ -489,12 +489,12 @@ class GanetiContext(object):
def GetWConfdContext(self, ec_id):
return config.GetWConfdContext(ec_id, self.livelock)
def AddNode(self, node, ec_id):
def AddNode(self, cfg, node, ec_id):
"""Adds a node to the configuration.
# Add it to the configuration
self.cfg.AddNode(node, ec_id)
cfg.AddNode(node, ec_id)
# If preseeding fails it'll not be added
......@@ -506,12 +506,12 @@ class GanetiContext(object):
# Synchronize the queue again
def RemoveNode(self, node):
def RemoveNode(self, cfg, node):
"""Removes a node from the configuration and lock manager.
# Remove node from configuration
# Notify job queue
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