From b3230b3282ef6dcbc05ab341c219f700291fe003 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Fri, 11 May 2012 16:56:49 +0200
Subject: [PATCH] gnt-group modify: Fix an update issue with diskparams
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/cmdlib.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 1544016e2..5b065e813 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -13939,12 +13939,16 @@ class LUGroupSetParams(LogicalUnit):
 
     if self.op.diskparams:
       diskparams = self.group.diskparams
+      uavdp = self._UpdateAndVerifyDiskParams
+      # For each disktemplate subdict update and verify the values
       new_diskparams = dict((dt,
-                             self._UpdateAndVerifyDiskParams(diskparams[dt],
-                                                        self.op.diskparams[dt]))
+                             uavdp(diskparams.get(dt, {}),
+                                   self.op.diskparams[dt]))
                             for dt in constants.DISK_TEMPLATES
                             if dt in self.op.diskparams)
-      self.new_diskparams = objects.FillDiskParams(diskparams, new_diskparams)
+      # As we've all subdicts of diskparams ready, lets merge the actual
+      # dict with all updated subdicts
+      self.new_diskparams = objects.FillDict(diskparams, new_diskparams)
 
     if self.op.hv_state:
       self.new_hv_state = _MergeAndVerifyHvState(self.op.hv_state,
-- 
GitLab