diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-12-07 18:20:03 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-12-07 21:27:24 +0000 |
| commit | fb27cc6979dcc8b4c0ac6595dae0c6e3e413e00f (patch) | |
| tree | e927fed1a4787f108a06af8602e665e69300ca4b /nova/tests | |
| parent | c3b7cce8101548428b64abb23ab88482bc79c36e (diff) | |
Fix race condition in XenAPI when using <object>.get_all
Fixes bug 887708
There are a handful of places where <object>.get_all is followed by a
<object>.get_record calls that are potentially racey. This patch fixes
all of these cases to use common code that is tolerant of HANDLE_INVALID
errors that would be indicative of a race between get_all and delete
Change-Id: Ib94adb6d21b6b55e7b26fc1da52ed46d9dba8275
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_xenapi.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index c72ee37a7..08441e19e 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -1110,13 +1110,15 @@ class HostStateTestCase(test.TestCase): """Tests HostState, which holds metrics from XenServer that get reported back to the Schedulers.""" - def _fake_safe_find_sr(self, session): + @classmethod + def _fake_safe_find_sr(cls, session): """None SR ref since we're ignoring it in FakeSR.""" return None def test_host_state(self): self.stubs = stubout.StubOutForTesting() - self.stubs.Set(vm_utils, 'safe_find_sr', self._fake_safe_find_sr) + self.stubs.Set(vm_utils.VMHelper, 'safe_find_sr', + self._fake_safe_find_sr) host_state = xenapi_conn.HostState(FakeSession()) stats = host_state._stats self.assertEquals(stats['disk_total'], 10000) |
