« Previous | Next » 

Revision 54c31fd3

ID54c31fd3ce69f3e9eefa1c5b856c4e66ecf776bc

Added by Michael Hanselmann over 12 years ago

LUGroupAssignNodes: Fix node membership corruption

Note: This bug only manifests itself in Ganeti 2.5, but since the
problematic code also exists in 2.4, I decided to fix it there.

If a node was assigned to a new group using “gnt-group assign-nodes” the
node object's group would be changed, but not the duplicate member list
in the group object. The latter is an optimization to require fewer
locks for other operations. The per-group member list is only kept in
memory and not written to disk.

Ganeti 2.5 starts to make use of the data kept in the per-group member
list and consequently fails when it is out of date. The following
commands can be used to reproduce the issue in 2.5 (in 2.4 the issue was
confirmed using additional logging):

$ gnt-group add foo
$ gnt-group assign-nodes foo $(gnt-node list --no-header -o name)
$ gnt-cluster verify # Fails with KeyError

This patch moves the code modifying node and group objects into
“config.ConfigWriter” to do the complete operation under the config
lock, and also to avoid making use of side-effects of modifying objects
without calling “ConfigWriter.Update”. A unittest is included.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>
(cherry picked from commit 218f4c3de706aca7e4521d7e1975f517cf5ecb9b)

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences