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

Update the cluster serial_no on certain operations

This patch adds update of the cluster serial number for:
  - add/remove node (as the cluster's node list is changed)
  - add/remove/rename instance (as the cluster's instance list is changed)
  - change the volume group name

The rule for updating this attribute is when cluster-wide properties are
changed, but not individual node/instance ones.

There are other remaining cases to handle, pending on the ssconf
changes.

Reviewed-by: ultrotter
parent 38d7239a
......@@ -424,6 +424,7 @@ class ConfigWriter:
self._OpenConfig()
instance.serial_no = 1
self._config_data.instances[instance.name] = instance
self._config_data.cluster.serial_no += 1
self._WriteConfig()
def _SetInstanceStatus(self, instance_name, status):
......@@ -462,6 +463,7 @@ class ConfigWriter:
if instance_name not in self._config_data.instances:
raise errors.ConfigurationError("Unknown instance '%s'" % instance_name)
del self._config_data.instances[instance_name]
self._config_data.cluster.serial_no += 1
self._WriteConfig()
@locking.ssynchronized(_config_lock)
......@@ -490,6 +492,7 @@ class ConfigWriter:
disk.iv_name))
self._config_data.instances[inst.name] = inst
self._config_data.cluster.serial_no += 1
self._WriteConfig()
@locking.ssynchronized(_config_lock)
......@@ -584,6 +587,7 @@ class ConfigWriter:
self._OpenConfig()
node.serial_no = 1
self._config_data.nodes[node.name] = node
self._config_data.cluster.serial_no += 1
self._WriteConfig()
@locking.ssynchronized(_config_lock)
......@@ -598,6 +602,7 @@ class ConfigWriter:
raise errors.ConfigurationError("Unknown node '%s'" % node_name)
del self._config_data.nodes[node_name]
self._config_data.cluster.serial_no += 1
self._WriteConfig()
@locking.ssynchronized(_config_lock, shared=1)
......@@ -827,6 +832,7 @@ class ConfigWriter:
"""
self._OpenConfig()
self._config_data.cluster.volume_group_name = vg_name
self._config_data.cluster.serial_no += 1
self._WriteConfig()
@locking.ssynchronized(_config_lock, shared=1)
......
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