Fix mixed pvm/hvm clusters and instance listing
authorIustin Pop <iustin@google.com>
Wed, 25 Feb 2009 15:03:43 +0000 (15:03 +0000)
committerIustin Pop <iustin@google.com>
Wed, 25 Feb 2009 15:03:43 +0000 (15:03 +0000)
The current implementation of the combining of the instance lists will
only do this for instances whose all four-fields match in both
hypervisors; however, this is broken for the dynamic fields (state,
times) which can change between the invocations of the two different
hypervisors if the instance is busy.

The patch checks only the memory and VCPUs, and makes mixed clusters
work even with 100% CPU instances.

Reviewed-by: imsnah

lib/backend.py

index 831f36c..18d439e 100644 (file)
@@ -660,9 +660,14 @@ def GetAllInstancesInfo(hypervisor_list):
           'state': state,
           'time': times,
           }
-        if name in output and output[name] != value:
-          raise errors.HypervisorError("Instance %s running duplicate"
-                                       " with different parameters" % name)
+        if name in output:
+          # we only check static parameters, like memory and vcpus,
+          # and not state and time which can change between the
+          # invocations of the different hypervisors
+          for key in 'memory', 'vcpus':
+            if value[key] != output[name][key]:
+              raise errors.HypervisorError("Instance %s is running twice"
+                                           " with different parameters" % name)
         output[name] = value
 
   return output