From 115c2131f694a16d09fdbd462f31a8ba5331fbba Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Tue, 10 Jul 2012 17:38:47 +0000 Subject: Raise Failure exception when setting duplicate other_config key When https://review.openstack.org/7971 got merged (and fixed in https://review.openstack.org/8504), it introduced a bug where a key in the xenapi other_config would get set twice. The real xenapi would raise a Failure exception in that case. So make sure the fake module also does that to ensure similar bugs will get caught in the future. Change-Id: Ie0151ffaf45dade930c3e8ff1279bfeab537bab2 --- nova/virt/xenapi/fake.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova') diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 228895ae3..416bf8b8e 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -499,6 +499,9 @@ class SessionBase(object): db_ref = _db_content['VDI'][vdi_ref] if not 'other_config' in db_ref: db_ref['other_config'] = {} + if key in db_ref['other_config']: + raise Failure(['MAP_DUPLICATE_KEY', 'VDI', 'other_config', + vdi_ref, key]) db_ref['other_config'][key] = value def VDI_copy(self, _1, vdi_to_copy_ref, sr_ref): -- cgit