From: John Griffith Date: Tue, 27 Nov 2012 05:46:58 +0000 (+0000) Subject: Revert "use O_DIRECT when copying from /dev/zero too" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=444cd5429cc00f3a4ddb5cde4b8b1c974b886e19;p=openstack-build%2Fcinder-build.git Revert "use O_DIRECT when copying from /dev/zero too" It turns out running oflag=direct against the LVM snapshot fails for an IO error every time. Works fine against the regular volume, but fails on snapshot. This reverts commit 1405a6440d646524d41adfed4fc1344948e2871f --- diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 0dacacfcd..35af09935 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -22,7 +22,6 @@ Drivers for volumes. import os import re -import stat import time from cinder import exception @@ -106,15 +105,7 @@ class VolumeDriver(object): def _copy_volume(self, srcstr, deststr, size_in_g): # Use O_DIRECT to avoid thrashing the system buffer cache - direct_flags = ['oflag=direct'] - try: - # Avoid trying O_DIRECT on virtual inputs like /dev/zero - # as it's not supported with such devices. - if not stat.S_ISCHR(os.stat(srcstr).st_mode): - direct_flags += ['iflag=direct'] - except OSError: - # Deal with any access issues below - pass + direct_flags = ('iflag=direct', 'oflag=direct') # Check whether O_DIRECT is supported try: