diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-10-24 21:55:12 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-10-24 22:43:43 +0000 |
| commit | 97cfccc2ce35b29fd98809b6c7ecdd86c56f76e3 (patch) | |
| tree | fffefd35433eed7d69f39a21727e9a1f25f2c7ab /nova/tests | |
| parent | 86b10119ca3649411c50ac3700a934efe40a09e5 (diff) | |
Fix concurrency of XenAPI sessions
Fixes bug 879044
Nova currently does not serialize access to the XenAPI session which can
result in multiple (green)threads trying to use the same HTTP connection.
This will typically only affect Python 2.7 which has updated xmlrpclib to
try to use one HTTP connection for multiple requests.
Change-Id: I101d63b822c8bf8c28674a836e4b54aa8259e1a8
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_xenapi.py | 7 | ||||
| -rw-r--r-- | nova/tests/xenapi/stubs.py | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index c2aa0a373..e2ed14495 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -1072,8 +1072,11 @@ class FakeSession(object): 'free-computed': 40} return json.dumps({'host_memory': vm}) - def get_xenapi(self): - return FakeXenApi() + def call_xenapi(self, method, *args): + f = FakeXenApi() + for m in method.split('.'): + f = getattr(f, m) + return f(*args) class HostStateTestCase(test.TestCase): diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index f44d96d20..c79bda682 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -38,7 +38,7 @@ def stubout_instance_snapshot(stubs): sr_ref = "fakesr" vdi_ref = create_vdi(name_label=name_label, read_only=False, sr_ref=sr_ref, sharable=False) - vdi_rec = session.get_xenapi().VDI.get_record(vdi_ref) + vdi_rec = session.call_xenapi("VDI.get_record", vdi_ref) vdi_uuid = vdi_rec['uuid'] return [dict(vdi_type='os', vdi_uuid=vdi_uuid)] @@ -307,7 +307,7 @@ def stub_out_migration_methods(stubs): def fake_get_vdi(cls, session, vm_ref): vdi_ref = fake.create_vdi(name_label='derp', read_only=False, sr_ref='herp', sharable=False) - vdi_rec = session.get_xenapi().VDI.get_record(vdi_ref) + vdi_rec = session.call_xenapi("VDI.get_record", vdi_ref) return vdi_ref, {'uuid': vdi_rec['uuid'], } def fake_shutdown(self, inst, vm, hard=True): |
