Commit f34901f8 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix logic bug in rev 2072

In revision 2072 "ConfigWriter: change cluster serial meaning" I misread
the serial_no update logic: it was about updating the serial number on
the object itself, not on the cluster.

So we don't actually have at all cluster serial number increase when a
node is changed (not removed/added).

This patch revers to the original always increase the target serial
number and adds increase of the cluster serial number in case a node has
been changed.

Reviewed-by: ultrotter
parent 33987705
......@@ -954,21 +954,24 @@ class ConfigWriter:
if self._config_data is None:
raise errors.ProgrammerError("Configuration file not read,"
" cannot save.")
update_serial = True
update_serial = False
if isinstance(target, objects.Cluster):
test = target == self._config_data.cluster
elif isinstance(target, objects.Node):
test = target in self._config_data.nodes.values()
update_serial = True
elif isinstance(target, objects.Instance):
test = target in self._config_data.instances.values()
update_serial = False
else:
raise errors.ProgrammerError("Invalid object type (%s) passed to"
" ConfigWriter.Update" % type(target))
if not test:
raise errors.ConfigurationError("Configuration updated since object"
" has been read or unknown object")
target.serial_no += 1
if update_serial:
target.serial_no += 1
# for node updates, we need to increase the cluster serial too
self._config_data.cluster.serial_no += 1
self._WriteConfig()
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