From cf7c0a7c10723495953be9bf99aedbe3838e0787 Mon Sep 17 00:00:00 2001 From: Matt Stephenson Date: Tue, 3 Apr 2012 14:38:09 -0700 Subject: Get unit tests functional in OS X * Add detection for directio to ensure the python runtime is built with O_DIRECT * Extend stubbing in test_libvirt to also stub out _supports_direct_io Change-Id: Id793d4039311396f0b3c3a52d2a1d951ec3c5e48 --- nova/virt/libvirt/connection.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nova/virt') diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index ac286a768..d1a2d0bfa 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -984,7 +984,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) -- cgit