From f23b5ae8e066440db15b587069ddec4f66024ce9 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 14 Oct 2008 10:20:10 +0000 Subject: [PATCH] Temporary fix for dual hvm/pvm instances We have a problem with the current model of combining instance lists from multiple hypervisors: we don't allow duplicates, but "xm list" gives the same output for both pvm and hvm. This is a lack in the actual xen hypervisor implementation/split between pvm and hvm, but for now we implement a weak workaround: identical instance params will be allowed, and merged. This breaks because there is a delta in listing, and should be treated as temporary workaround only. Note that there are two cases for duplicate instance: the above one (xen is the same, whether pvm or hvm), and the other case, the real error, when we have two different hypervisors reporting the same instance name. The latter case needs to be handled better (not by refusing to list the instances in the backend). Reviewed-by: ultrotter --- lib/backend.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 6f294d934..9a6b5e5cc 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -502,14 +502,16 @@ def GetAllInstancesInfo(hypervisor_list): iinfo = hypervisor.GetHypervisor(hname).GetAllInstancesInfo() if iinfo: for name, inst_id, memory, vcpus, state, times in iinfo: - if name in output: - raise errors.HypervisorError("Instance %s running duplicate" % name) - output[name] = { + value = { 'memory': memory, 'vcpus': vcpus, 'state': state, 'time': times, } + if name in output and output[name] != value: + raise errors.HypervisorError("Instance %s running duplicate" + " with different parameters" % name) + output[name] = value return output -- GitLab