Rename exceptions to use SwiftOnFile name.

Rename exceptions from GlusterFS to SwiftOnFile names.

Change-Id: Idddc16777cd08e66ce6634a65e4199db1f67e20a
This commit is contained in:
Bill Owen 2014-09-25 10:46:28 -07:00
parent d8765aac78
commit d187234c11
7 changed files with 98 additions and 98 deletions

View File

@ -14,33 +14,33 @@
# limitations under the License.
class GlusterFileSystemOSError(OSError):
class SwiftOnFileSystemOSError(OSError):
pass
class GlusterFileSystemIOError(IOError):
class SwiftOnFileSystemIOError(IOError):
pass
class GlusterfsException(Exception):
class SwiftOnFileFsException(Exception):
pass
class FailureToMountError(GlusterfsException):
class FailureToMountError(SwiftOnFileFsException):
pass
class FileOrDirNotFoundError(GlusterfsException):
class FileOrDirNotFoundError(SwiftOnFileFsException):
pass
class NotDirectoryError(GlusterfsException):
class NotDirectoryError(SwiftOnFileFsException):
pass
class AlreadyExistsAsDir(GlusterfsException):
class AlreadyExistsAsDir(SwiftOnFileFsException):
pass
class AlreadyExistsAsFile(GlusterfsException):
class AlreadyExistsAsFile(SwiftOnFileFsException):
pass

View File

@ -26,7 +26,7 @@ import ctypes
from eventlet import sleep
from swift.common.utils import load_libc_function
from swiftonfile.swift.common.exceptions import FileOrDirNotFoundError, \
NotDirectoryError, GlusterFileSystemOSError
NotDirectoryError, SwiftOnFileSystemOSError
from swift.common.exceptions import DiskFileNoSpace
@ -81,7 +81,7 @@ def do_write(fd, buf):
fd, len(buf), err, filename)
raise DiskFileNoSpace()
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.write("%s", ...)' % (err.strerror, fd))
return cnt
@ -90,7 +90,7 @@ def do_read(fd, n):
try:
buf = os.read(fd, n)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.write("%s", ...)' % (err.strerror, fd))
return buf
@ -109,7 +109,7 @@ def do_ismount(path):
# It doesn't exist -- so not a mount point :-)
return False
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.lstat("%s")' % (err.strerror, path))
if stat.S_ISLNK(s1.st_mode):
@ -119,7 +119,7 @@ def do_ismount(path):
try:
s2 = os.lstat(os.path.join(path, '..'))
except os.error as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.lstat("%s")' % (err.strerror,
os.path.join(path, '..')))
@ -146,7 +146,7 @@ def do_listdir(path):
try:
buf = os.listdir(path)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.listdir("%s")' % (err.strerror, path))
return buf
@ -161,7 +161,7 @@ def dir_empty(path):
try:
files = do_listdir(path)
return not files
except GlusterFileSystemOSError as err:
except SwiftOnFileSystemOSError as err:
if err.errno == errno.ENOENT:
raise FileOrDirNotFoundError()
if err.errno == errno.ENOTDIR:
@ -173,7 +173,7 @@ def do_rmdir(path):
try:
os.rmdir(path)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.rmdir("%s")' % (err.strerror, path))
@ -181,7 +181,7 @@ def do_chown(path, uid, gid):
try:
os.chown(path, uid, gid)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.chown("%s", %s, %s)' % (
err.strerror, path, uid, gid))
@ -190,7 +190,7 @@ def do_fchown(fd, uid, gid):
try:
os.fchown(fd, uid, gid)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.fchown(%s, %s, %s)' % (
err.strerror, fd, uid, gid))
@ -213,7 +213,7 @@ def do_stat(path):
if err.errno == errno.ENOENT:
stats = None
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.stat("%s")[%d attempts]' % (
err.strerror, path, i))
if i > 0:
@ -222,7 +222,7 @@ def do_stat(path):
path, i, 'success' if stats else 'failure')
return stats
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
serr.errno, '%s, os.stat("%s")[%d attempts]' % (
serr.strerror, path, _STAT_ATTEMPTS))
@ -231,7 +231,7 @@ def do_fstat(fd):
try:
stats = os.fstat(fd)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.fstat(%s)' % (err.strerror, fd))
return stats
@ -240,7 +240,7 @@ def do_open(path, flags, **kwargs):
try:
fd = os.open(path, flags, **kwargs)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.open("%s", %x, %r)' % (
err.strerror, path, flags, kwargs))
return fd
@ -260,7 +260,7 @@ def do_close(fd):
fd, err, filename)
raise DiskFileNoSpace()
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.close(%s)' % (err.strerror, fd))
@ -269,7 +269,7 @@ def do_unlink(path, log=True):
os.unlink(path)
except OSError as err:
if err.errno != errno.ENOENT:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.unlink("%s")' % (err.strerror, path))
else:
logging.warn("fs_utils: os.unlink failed on non-existent path: %s",
@ -280,7 +280,7 @@ def do_rename(old_path, new_path):
try:
os.rename(old_path, new_path)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.rename("%s", "%s")' % (
err.strerror, old_path, new_path))
@ -289,7 +289,7 @@ def do_fsync(fd):
try:
os.fsync(fd)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.fsync("%s")' % (err.strerror, fd))
@ -299,7 +299,7 @@ def do_fdatasync(fd):
except AttributeError:
do_fsync(fd)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.fsync("%s")' % (err.strerror, fd))
@ -319,7 +319,7 @@ def do_lseek(fd, pos, how):
try:
os.lseek(fd, pos, how)
except OSError as err:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.fsync("%s")' % (err.strerror, fd))
@ -339,7 +339,7 @@ def mkdirs(path):
do_log_rl("mkdirs(%s) failed: %s", path, err)
raise DiskFileNoSpace()
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, '%s, os.makedirs("%s")' % (err.strerror, path))

View File

@ -21,7 +21,7 @@ import logging
from hashlib import md5
from eventlet import sleep
import cPickle as pickle
from swiftonfile.swift.common.exceptions import GlusterFileSystemIOError
from swiftonfile.swift.common.exceptions import SwiftOnFileSystemIOError
from swift.common.exceptions import DiskFileNoSpace
from swiftonfile.swift.common.fs_utils import do_stat, \
do_walk, do_rmdir, do_log_rl, get_filename_from_fd, do_open, \
@ -95,7 +95,7 @@ def read_metadata(path_or_fd):
else:
# Note that we don't touch the keys on errors fetching the
# data since it could be a transient state.
raise GlusterFileSystemIOError(
raise SwiftOnFileSystemIOError(
err.errno, 'getxattr("%s", %s)' % (path_or_fd, key))
else:
try:
@ -141,7 +141,7 @@ def write_metadata(path_or_fd, metadata):
path_or_fd, err)
raise DiskFileNoSpace()
else:
raise GlusterFileSystemIOError(
raise SwiftOnFileSystemIOError(
err.errno,
'setxattr("%s", %s, metastr)' % (path_or_fd, key))
metastr = metastr[MAX_XATTR_SIZE:]
@ -156,7 +156,7 @@ def clean_metadata(path_or_fd):
except IOError as err:
if err.errno == errno.ENODATA:
break
raise GlusterFileSystemIOError(
raise SwiftOnFileSystemIOError(
err.errno, 'removexattr("%s", %s)' % (path_or_fd, key))
key += 1

View File

@ -37,7 +37,7 @@ from swift.common.exceptions import DiskFileNotExist, DiskFileError, \
DiskFileExpired
from swift.common.swob import multi_range_iterator
from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
from swiftonfile.swift.common.exceptions import SwiftOnFileSystemOSError
from swiftonfile.swift.common.fs_utils import do_fstat, do_open, do_close, \
do_unlink, do_chown, do_fsync, do_fchown, do_stat, do_write, do_read, \
do_fadvise64, do_rename, do_fdatasync, do_lseek, do_mkdir
@ -87,7 +87,7 @@ def make_directory(full_path, uid, gid, metadata=None):
# not necessary.
try:
stats = do_stat(full_path)
except GlusterFileSystemOSError as serr:
except SwiftOnFileSystemOSError as serr:
# FIXME: Ideally we'd want to return an appropriate error
# message and code in the PUT Object REST API response.
raise DiskFileError("make_directory: mkdir failed"
@ -121,7 +121,7 @@ def make_directory(full_path, uid, gid, metadata=None):
_random_sleep()
try:
stats = do_stat(full_path)
except GlusterFileSystemOSError as serr:
except SwiftOnFileSystemOSError as serr:
if serr.errno == errno.ENOENT:
errmsg = "make_directory: mkdir failed on" \
" path %s (EIO), and a subsequent stat on" \
@ -387,7 +387,7 @@ class DiskFileWriter(object):
attempts += 1
continue
else:
raise GlusterFileSystemOSError(
raise SwiftOnFileSystemOSError(
err.errno, "%s, rename('%s', '%s')" % (
err.strerror, self._tmppath, df._data_file))
else:
@ -634,7 +634,7 @@ class DiskFile(object):
# Writes are always performed to a temporary file
try:
fd = do_open(self._data_file, os.O_RDONLY | O_CLOEXEC)
except GlusterFileSystemOSError as err:
except SwiftOnFileSystemOSError as err:
if err.errno in (errno.ENOENT, errno.ENOTDIR):
# If the file does exist, or some part of the path does not
# exist, raise the expected DiskFileNotExist
@ -872,7 +872,7 @@ class DiskFile(object):
try:
fd = do_open(tmppath,
os.O_WRONLY | os.O_CREAT | os.O_EXCL | O_CLOEXEC)
except GlusterFileSystemOSError as gerr:
except SwiftOnFileSystemOSError as gerr:
if gerr.errno in (errno.ENOSPC, errno.EDQUOT):
# Raise DiskFileNoSpace to be handled by upper layers when
# there is no space on disk OR when quota is exceeded

View File

@ -24,7 +24,7 @@ from time import sleep
from tempfile import mkdtemp, mkstemp
from swiftonfile.swift.common import fs_utils as fs
from swiftonfile.swift.common.exceptions import NotDirectoryError, \
FileOrDirNotFoundError, GlusterFileSystemOSError
FileOrDirNotFoundError, SwiftOnFileSystemOSError
from swift.common.exceptions import DiskFileNoSpace
@ -91,10 +91,10 @@ class TestFsUtils(unittest.TestCase):
with patch("os.lstat", _mock_os_lstat):
try:
fs.do_ismount(tmpdir)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
shutil.rmtree(tmpdir)
@ -125,10 +125,10 @@ class TestFsUtils(unittest.TestCase):
with patch("os.lstat", _mock_os_lstat):
try:
fs.do_ismount(tmpdir)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
shutil.rmtree(tmpdir)
@ -155,7 +155,7 @@ class TestFsUtils(unittest.TestCase):
with patch("os.lstat", _mock_os_lstat):
try:
fs.do_ismount(tmpdir)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
self.fail("Unexpected exception")
else:
pass
@ -187,7 +187,7 @@ class TestFsUtils(unittest.TestCase):
with patch("os.lstat", _mock_os_lstat):
try:
fs.do_ismount(tmpdir)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
self.fail("Unexpected exception")
else:
pass
@ -214,10 +214,10 @@ class TestFsUtils(unittest.TestCase):
try:
fs.do_open(os.path.join('/tmp', str(random.random())),
os.O_RDONLY)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
def test_do_write(self):
fd, tmpfile = mkstemp()
@ -234,13 +234,13 @@ class TestFsUtils(unittest.TestCase):
fd1 = os.open(tmpfile, os.O_RDONLY)
try:
fs.do_write(fd1, "test")
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
finally:
os.close(fd1)
except GlusterFileSystemOSError as ose:
except SwiftOnFileSystemOSError as ose:
self.fail("Open failed with %s" % ose.strerror)
finally:
os.close(fd)
@ -283,7 +283,7 @@ class TestFsUtils(unittest.TestCase):
tmpdir = mkdtemp()
try:
fs.mkdirs(tmpdir)
except (GlusterFileSystemOSError, OSError):
except (SwiftOnFileSystemOSError, OSError):
self.fail("Unexpected exception")
else:
pass
@ -298,7 +298,7 @@ class TestFsUtils(unittest.TestCase):
except OSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError exception")
self.fail("Expected SwiftOnFileSystemOSError exception")
finally:
os.close(fd)
shutil.rmtree(tmpdir)
@ -311,7 +311,7 @@ class TestFsUtils(unittest.TestCase):
except OSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError exception")
self.fail("Expected SwiftOnFileSystemOSError exception")
finally:
os.close(fd)
shutil.rmtree(tmpdir)
@ -384,10 +384,10 @@ class TestFsUtils(unittest.TestCase):
try:
path = os.path.join('/tmp', str(random.random()))
fs.do_listdir(path)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
def test_do_fstat(self):
tmpdir = mkdtemp()
@ -405,10 +405,10 @@ class TestFsUtils(unittest.TestCase):
def test_do_fstat_err(self):
try:
fs.do_fstat(1000)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
def test_do_stat(self):
tmpdir = mkdtemp()
@ -435,10 +435,10 @@ class TestFsUtils(unittest.TestCase):
try:
with patch('os.stat', mock_os_stat_eacces):
fs.do_stat('/tmp')
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
def test_do_stat_eio_once(self):
count = [0]
@ -474,10 +474,10 @@ class TestFsUtils(unittest.TestCase):
try:
with patch('os.stat', mock_os_stat_eio):
fs.do_stat('/tmp')
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
def test_do_close(self):
fd, tmpfile = mkstemp()
@ -499,10 +499,10 @@ class TestFsUtils(unittest.TestCase):
try:
fs.do_close(fd)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
finally:
os.remove(tmpfile)
@ -529,10 +529,10 @@ class TestFsUtils(unittest.TestCase):
tmpdir = mkdtemp()
try:
fs.do_unlink(tmpdir)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail('GlusterFileSystemOSError expected')
self.fail('SwiftOnFileSystemOSError expected')
finally:
os.rmdir(tmpdir)
@ -551,10 +551,10 @@ class TestFsUtils(unittest.TestCase):
srcpath = os.path.join('/tmp', str(random.random()))
destpath = os.path.join('/tmp', str(random.random()))
fs.do_rename(srcpath, destpath)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError expected")
self.fail("SwiftOnFileSystemOSError expected")
def test_dir_empty(self):
tmpdir = mkdtemp()
@ -572,10 +572,10 @@ class TestFsUtils(unittest.TestCase):
with patch("os.listdir", _mock_os_listdir):
try:
fs.dir_empty("/tmp")
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("GlusterFileSystemOSError exception expected")
self.fail("SwiftOnFileSystemOSError exception expected")
def test_dir_empty_notfound(self):
try:
@ -605,17 +605,17 @@ class TestFsUtils(unittest.TestCase):
fd, tmpfile = mkstemp(dir=tmpdir)
try:
fs.do_rmdir(tmpfile)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
assert os.path.exists(subdir)
try:
fs.do_rmdir(tmpdir)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
assert os.path.exists(subdir)
fs.do_rmdir(subdir)
assert not os.path.exists(subdir)
@ -633,12 +633,12 @@ class TestFsUtils(unittest.TestCase):
else:
try:
fs.do_chown(subdir, 20000, 20000)
except GlusterFileSystemOSError as ex:
except SwiftOnFileSystemOSError as ex:
if ex.errno != errno.EPERM:
self.fail(
"Expected GlusterFileSystemOSError(errno=EPERM)")
"Expected SwiftOnFileSystemOSError(errno=EPERM)")
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
shutil.rmtree(tmpdir)
@ -652,12 +652,12 @@ class TestFsUtils(unittest.TestCase):
else:
try:
fs.do_chown(tmpfile, 20000, 20000)
except GlusterFileSystemOSError as ex:
except SwiftOnFileSystemOSError as ex:
if ex.errno != errno.EPERM:
self.fail(
"Expected GlusterFileSystemOSError(errno=EPERM")
"Expected SwiftOnFileSystemOSError(errno=EPERM")
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
os.close(fd)
shutil.rmtree(tmpdir)
@ -666,10 +666,10 @@ class TestFsUtils(unittest.TestCase):
try:
fs.do_chown(os.path.join('/tmp', str(random.random())),
20000, 20000)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
def test_fchown(self):
tmpdir = mkdtemp()
@ -681,12 +681,12 @@ class TestFsUtils(unittest.TestCase):
else:
try:
fs.do_fchown(fd, 20000, 20000)
except GlusterFileSystemOSError as ex:
except SwiftOnFileSystemOSError as ex:
if ex.errno != errno.EPERM:
self.fail(
"Expected GlusterFileSystemOSError(errno=EPERM)")
"Expected SwiftOnFileSystemOSError(errno=EPERM)")
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
os.close(fd)
shutil.rmtree(tmpdir)
@ -702,12 +702,12 @@ class TestFsUtils(unittest.TestCase):
else:
try:
fs.do_fchown(fd_rd, 20000, 20000)
except GlusterFileSystemOSError as ex:
except SwiftOnFileSystemOSError as ex:
if ex.errno != errno.EPERM:
self.fail(
"Expected GlusterFileSystemOSError(errno=EPERM)")
"Expected SwiftOnFileSystemOSError(errno=EPERM)")
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
os.close(fd_rd)
os.close(fd)
@ -721,7 +721,7 @@ class TestFsUtils(unittest.TestCase):
os.write(fd, 'test')
with patch('os.fsync', mock_os_fsync):
assert fs.do_fsync(fd) is None
except GlusterFileSystemOSError as ose:
except SwiftOnFileSystemOSError as ose:
self.fail('Opening a temporary file failed with %s' %
ose.strerror)
else:
@ -739,10 +739,10 @@ class TestFsUtils(unittest.TestCase):
os.close(fd)
try:
fs.do_fsync(fd)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
shutil.rmtree(tmpdir)
@ -754,7 +754,7 @@ class TestFsUtils(unittest.TestCase):
os.write(fd, 'test')
with patch('os.fdatasync', mock_os_fdatasync):
assert fs.do_fdatasync(fd) is None
except GlusterFileSystemOSError as ose:
except SwiftOnFileSystemOSError as ose:
self.fail('Opening a temporary file failed with %s' %
ose.strerror)
else:
@ -772,10 +772,10 @@ class TestFsUtils(unittest.TestCase):
os.close(fd)
try:
fs.do_fdatasync(fd)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected GlusterFileSystemOSError")
self.fail("Expected SwiftOnFileSystemOSError")
finally:
shutil.rmtree(tmpdir)

View File

@ -27,7 +27,7 @@ import shutil
from collections import defaultdict
from mock import patch
from swiftonfile.swift.common import utils, Glusterfs
from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
from swiftonfile.swift.common.exceptions import SwiftOnFileSystemOSError
from swift.common.exceptions import DiskFileNoSpace
#
@ -349,7 +349,7 @@ class TestUtils(unittest.TestCase):
try:
utils.get_object_metadata(
os.path.join(tf.name, "doesNotEx1st"))
except GlusterFileSystemOSError as e:
except SwiftOnFileSystemOSError as e:
assert e.errno != errno.ENOENT
else:
self.fail("Expected exception")

View File

@ -32,7 +32,7 @@ from swift.common.exceptions import DiskFileNotExist, DiskFileError, \
DiskFileNoSpace, DiskFileNotOpen
from swift.common.utils import ThreadPool
from swiftonfile.swift.common.exceptions import GlusterFileSystemOSError
from swiftonfile.swift.common.exceptions import SwiftOnFileSystemOSError
import swiftonfile.swift.common.utils
from swiftonfile.swift.common.utils import normalize_timestamp
import swiftonfile.swift.obj.diskfile
@ -764,7 +764,7 @@ class TestDiskFile(unittest.TestCase):
tmppath = dw._tmppath
dw.write(body)
dw.put(metadata)
except GlusterFileSystemOSError:
except SwiftOnFileSystemOSError:
pass
else:
self.fail("Expected exception DiskFileError")