Only update ssconf on cluster serial change
authorIustin Pop <iustin@google.com>
Sun, 23 Nov 2008 15:35:02 +0000 (15:35 +0000)
committerIustin Pop <iustin@google.com>
Sun, 23 Nov 2008 15:35:02 +0000 (15:35 +0000)
There is no need to update ssconf if the cluster serial number has not
changed.

Reviewed-by: ultrotter

lib/config.py

index 0d1d897..f0457f2 100644 (file)
@@ -802,6 +802,9 @@ class ConfigWriter:
       raise errors.ConfigurationError("Incomplete configuration"
                                       " (missing cluster.rsahostkeypub)")
     self._config_data = data
+    # init the last serial as -1 so that the next write will cause
+    # ssconf update
+    self._last_cluster_serial = -1
 
   def _DistributeConfig(self):
     """Distribute the configuration to the other nodes.
@@ -860,7 +863,9 @@ class ConfigWriter:
     self._DistributeConfig()
 
     # Write ssconf files on all nodes (including locally)
-    rpc.RpcRunner.call_write_ssconf_files(self._UnlockedGetNodeList())
+    if self._last_cluster_serial < self._config_data.cluster.serial_no:
+      rpc.RpcRunner.call_write_ssconf_files(self._UnlockedGetNodeList())
+      self._last_cluster_serial = self._config_data.cluster.serial_no
 
   @locking.ssynchronized(_config_lock)
   def InitConfig(self, version, cluster_config, master_node_config):