Cleanup exception logging
Add IOERROR.strerror to exception messages in utils.py Correct some types in exception messages in fs_utils.py Change-Id: Iac81860b08daf8cdbb7f8e8950f4ab6104b75bd4 Closes-Bug: #1445237
This commit is contained in:
parent
c6aae2b0cc
commit
0d11589042
@ -65,7 +65,7 @@ def do_read(fd, n):
|
|||||||
buf = os.read(fd, n)
|
buf = os.read(fd, n)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise SwiftOnFileSystemOSError(
|
raise SwiftOnFileSystemOSError(
|
||||||
err.errno, '%s, os.write("%s", ...)' % (err.strerror, fd))
|
err.errno, '%s, os.read("%s", ...)' % (err.strerror, fd))
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ def do_fdatasync(fd):
|
|||||||
do_fsync(fd)
|
do_fsync(fd)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise SwiftOnFileSystemOSError(
|
raise SwiftOnFileSystemOSError(
|
||||||
err.errno, '%s, os.fsync("%s")' % (err.strerror, fd))
|
err.errno, '%s, os.fdatasync("%s")' % (err.strerror, fd))
|
||||||
|
|
||||||
|
|
||||||
_posix_fadvise = None
|
_posix_fadvise = None
|
||||||
@ -267,7 +267,7 @@ def do_lseek(fd, pos, how):
|
|||||||
os.lseek(fd, pos, how)
|
os.lseek(fd, pos, how)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise SwiftOnFileSystemOSError(
|
raise SwiftOnFileSystemOSError(
|
||||||
err.errno, '%s, os.fsync("%s")' % (err.strerror, fd))
|
err.errno, '%s, os.lseek("%s")' % (err.strerror, fd))
|
||||||
|
|
||||||
|
|
||||||
def get_filename_from_fd(fd, verify=False):
|
def get_filename_from_fd(fd, verify=False):
|
||||||
|
@ -96,7 +96,8 @@ def read_metadata(path_or_fd):
|
|||||||
# Note that we don't touch the keys on errors fetching the
|
# Note that we don't touch the keys on errors fetching the
|
||||||
# data since it could be a transient state.
|
# data since it could be a transient state.
|
||||||
raise SwiftOnFileSystemIOError(
|
raise SwiftOnFileSystemIOError(
|
||||||
err.errno, 'getxattr("%s", %s)' % (path_or_fd, key))
|
err.errno, '%s, getxattr("%s", %s)' % (err.strerror,
|
||||||
|
path_or_fd, key))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# If this key provides all or the remaining part of the pickle
|
# If this key provides all or the remaining part of the pickle
|
||||||
@ -143,7 +144,8 @@ def write_metadata(path_or_fd, metadata):
|
|||||||
else:
|
else:
|
||||||
raise SwiftOnFileSystemIOError(
|
raise SwiftOnFileSystemIOError(
|
||||||
err.errno,
|
err.errno,
|
||||||
'setxattr("%s", %s, metastr)' % (path_or_fd, key))
|
'%s, setxattr("%s", %s, metastr)' % (err.strerror,
|
||||||
|
path_or_fd, key))
|
||||||
metastr = metastr[MAX_XATTR_SIZE:]
|
metastr = metastr[MAX_XATTR_SIZE:]
|
||||||
key += 1
|
key += 1
|
||||||
|
|
||||||
@ -157,7 +159,8 @@ def clean_metadata(path_or_fd):
|
|||||||
if err.errno == errno.ENODATA:
|
if err.errno == errno.ENODATA:
|
||||||
break
|
break
|
||||||
raise SwiftOnFileSystemIOError(
|
raise SwiftOnFileSystemIOError(
|
||||||
err.errno, 'removexattr("%s", %s)' % (path_or_fd, key))
|
err.errno, '%s, removexattr("%s", %s)' % (err.strerror,
|
||||||
|
path_or_fd, key))
|
||||||
key += 1
|
key += 1
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user