From f34901f8c12b73ce09ceb03673572f1226b40466 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 27 Nov 2008 10:21:46 +0000 Subject: [PATCH] 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 --- lib/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/config.py b/lib/config.py index 739f76109..1101e4136 100644 --- a/lib/config.py +++ b/lib/config.py @@ -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() -- GitLab