diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-04-04 00:42:23 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-04-04 00:42:23 +0000 |
| commit | 01b9cece5ca4232648ca305eb7e08e8b45176426 (patch) | |
| tree | 37c3176c42fc23911afdc920f151690415b8db6c | |
| parent | 06407be0da134db23cfd02fe320caa5c444315c2 (diff) | |
| parent | cf7c0a7c10723495953be9bf99aedbe3838e0787 (diff) | |
Merge "Get unit tests functional in OS X"
| -rw-r--r-- | nova/tests/test_libvirt.py | 6 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index ef0307158..59b9fe460 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -916,6 +916,12 @@ class LibvirtConnTestCase(test.TestCase): self.stubs.Set(os, 'open', os_open_stub) + def connection_supports_direct_io_stub(*args, **kwargs): + return directio_supported + + self.stubs.Set(connection.LibvirtConnection, + '_supports_direct_io', connection_supports_direct_io_stub) + user_context = context.RequestContext(self.user_id, self.project_id) instance_ref = db.instance_create(user_context, self.test_instance) network_info = _fake_network_info(self.stubs, 1) diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 5d27c6f5a..3c4bbb016 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -988,7 +988,13 @@ class LibvirtConnection(driver.ComputeDriver): @staticmethod def _supports_direct_io(dirpath): + + if not hasattr(os, 'O_DIRECT'): + LOG.debug("This python runtime does not support direct I/O") + return False + testfile = os.path.join(dirpath, ".directio.test") + hasDirectIO = True try: f = os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT) |
