From 9d38c6e1c2d8eea9aaef8b1fb9e3cfd25a0a5daa Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 27 Sep 2008 15:58:13 +0000
Subject: [PATCH] Switch the global serial_no to the top object
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently the serial_no that is incremented every time the configuration
file is written is located on the 'cluster' object in the configuration
structure. However, this is wrong as the cluster serial_no should be
incremented only when the cluster state is changed (for whatever
definition of β€œchanged” we will use), not simply because the
configuration file is written.

This patch changes so that the ConfigWriter._BumpSerialNo affects the
top-level ConfigData object.

Reviewed-by: ultrotter
---
 lib/config.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/config.py b/lib/config.py
index e24a17d3d..ef2aedbec 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -677,7 +677,7 @@ class ConfigWriter:
     """Bump up the serial number of the config.
 
     """
-    self._config_data.cluster.serial_no += 1
+    self._config_data.serial_no += 1
 
   def _OpenConfig(self):
     """Read the config data from disk.
@@ -805,7 +805,8 @@ class ConfigWriter:
 
     self._config_data = objects.ConfigData(nodes={node: nodeconfig},
                                            instances={},
-                                           cluster=globalconfig)
+                                           cluster=globalconfig,
+                                           serial_no=1)
     self._WriteConfig()
 
   @locking.ssynchronized(_config_lock, shared=1)
-- 
GitLab