Check disk template in right dict when copying
authorThomas Thrainer <thomasth@google.com>
Wed, 31 Jul 2013 14:16:39 +0000 (16:16 +0200)
committerThomas Thrainer <thomasth@google.com>
Thu, 1 Aug 2013 06:13:07 +0000 (08:13 +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.

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

lib/cmdlib.py

index ba1ad64..5c12c81 100644 (file)
@@ -4345,7 +4345,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)