Fix IPolicy violation check in LUGroupSetParams
authorThomas Thrainer <thomasth@google.com>
Tue, 13 Aug 2013 09:54:52 +0000 (11:54 +0200)
committerThomas Thrainer <thomasth@google.com>
Tue, 13 Aug 2013 12:33:26 +0000 (14:33 +0200)
cfg.GetMultiInstanceInfoByName returns a list of tuples, not a list of
instance objects which is required by ComputeNewInstanceViolations.
This patch fixes this type error.

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

lib/cmdlib/group.py

index 9d328b5..98a3891 100644 (file)
@@ -453,12 +453,14 @@ class LUGroupSetParams(LogicalUnit):
       new_ipolicy = cluster.SimpleFillIPolicy(self.new_ipolicy)
       CheckIpolicyVsDiskTemplates(new_ipolicy,
                                   cluster.enabled_disk_templates)
-      instances = self.cfg.GetMultiInstanceInfoByName(owned_instance_names)
+      instances = \
+        dict(self.cfg.GetMultiInstanceInfoByName(owned_instance_names))
       gmi = ganeti.masterd.instance
       violations = \
           ComputeNewInstanceViolations(gmi.CalculateGroupIPolicy(cluster,
                                                                  self.group),
-                                       new_ipolicy, instances, self.cfg)
+                                       new_ipolicy, instances.values(),
+                                       self.cfg)
 
       if violations:
         self.LogWarning("After the ipolicy change the following instances"