]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Revert "use O_DIRECT when copying from /dev/zero too"
authorJohn Griffith <john.griffith@solidfire.com>
Tue, 27 Nov 2012 05:46:58 +0000 (05:46 +0000)
committerGerrit Code Review <review@openstack.org>
Tue, 27 Nov 2012 05:46:58 +0000 (05:46 +0000)
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

cinder/volume/driver.py

index 0dacacfcd016250517d3a38697073674c4a9c3fa..35af09935344a9d11eace7e0b134af70c2e1b1c1 100644 (file)
@@ -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: