summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2012-07-10 17:38:47 +0000
committerJohannes Erdfelt <johannes.erdfelt@rackspace.com>2012-07-10 17:38:47 +0000
commit115c2131f694a16d09fdbd462f31a8ba5331fbba (patch)
tree765c5ce8de3bd22431d2096199492452b3b4ffa0 /nova
parent66349b22a9c6b584e46cd913b9177ae48ea79ad9 (diff)
downloadnova-115c2131f694a16d09fdbd462f31a8ba5331fbba.tar.gz
nova-115c2131f694a16d09fdbd462f31a8ba5331fbba.tar.xz
nova-115c2131f694a16d09fdbd462f31a8ba5331fbba.zip
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
Diffstat (limited to 'nova')
-rw-r--r--nova/virt/xenapi/fake.py3
1 files changed, 3 insertions, 0 deletions
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):