Check disk template in right dict when copying
authorThomas Thrainer <thomasth@google.com>
Wed, 31 Jul 2013 13:41:43 +0000 (15:41 +0200)
committerThomas Thrainer <thomasth@google.com>
Thu, 1 Aug 2013 06:16:56 +0000 (08:16 +0200)
Due to the structure of the code this condition can't possibly be true.
We have to look in the new_diskparams dict instead, otherwise it'd be
possible to try to update a non-existing entry.

(The same patch is in stable-2.7 as 106441d already).

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cmdlib/cluster.py

index c520530..8893eb2 100644 (file)
@@ -803,7 +803,7 @@ class LUClusterSetParams(LogicalUnit):
     self.new_diskparams = objects.FillDict(cluster.diskparams, {})
     if self.op.diskparams:
       for dt_name, dt_params in self.op.diskparams.items():
-        if dt_name not in self.op.diskparams:
+        if dt_name not in self.new_diskparams:
           self.new_diskparams[dt_name] = dt_params
         else:
           self.new_diskparams[dt_name].update(dt_params)