diff options
author | Chetan Risbud <crisbud@redhat.com> | 2013-07-31 19:36:32 +0530 |
---|---|---|
committer | Luis Pabon <lpabon@redhat.com> | 2013-08-13 12:34:48 -0700 |
commit | 32ce873516af0baf76cfb9fea831434b672f3516 (patch) | |
tree | 3075eadd43a1105fd10033550ea37557f6f59418 /gluster/swift/common | |
parent | f54f00dc313d52414230e3c05dfa383ad7e7a8ce (diff) |
Gluster to handle ENOSPC (Error 28) correctly
A gluster volume could yield an ENOSPC condition seeing
that a volume is full. This needed to handled correctly.
Added error handling.
BUG: 985253
https://bugzilla.redhat.com/show_bug.cgi?id=985253
Change-Id: I85472c0a81a354a2796327fead606da3a938d4bf
Signed-off-by: Chetan Risbud <crisbud@redhat.com>
Reviewed-on: http://review.gluster.org/5362
Reviewed-by: Peter Portante <pportant@redhat.com>
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
Reviewed-on: http://review.gluster.org/5570
Diffstat (limited to 'gluster/swift/common')
-rw-r--r-- | gluster/swift/common/DiskFile.py | 9 | ||||
-rw-r--r-- | gluster/swift/common/exceptions.py | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gluster/swift/common/DiskFile.py b/gluster/swift/common/DiskFile.py index 4b6602e..d64726b 100644 --- a/gluster/swift/common/DiskFile.py +++ b/gluster/swift/common/DiskFile.py @@ -24,7 +24,9 @@ from eventlet import sleep from contextlib import contextmanager from swift.common.utils import TRUE_VALUES, fallocate from swift.common.exceptions import DiskFileNotExist, DiskFileError -from gluster.swift.common.exceptions import GlusterFileSystemOSError + +from gluster.swift.common.exceptions import GlusterFileSystemOSError, \ + DiskFileNoSpace from gluster.swift.common.fs_utils import do_fstat, do_open, do_close, \ do_unlink, do_chown, os_path, do_fsync, do_fchown, do_stat from gluster.swift.common.utils import read_metadata, write_metadata, \ @@ -702,6 +704,11 @@ class Gluster_DiskFile(DiskFile): fd = do_open(tmppath, os.O_WRONLY | os.O_CREAT | os.O_EXCL | O_CLOEXEC) except GlusterFileSystemOSError as gerr: + if gerr.errno == errno.ENOSPC: + # Raise DiskFileNoSpace to be handled by upper layers + excp = DiskFileNoSpace() + excp.drive = os.path.basename(self.device_path) + raise excp if gerr.errno == errno.EEXIST: # Retry with a different random number. continue diff --git a/gluster/swift/common/exceptions.py b/gluster/swift/common/exceptions.py index 010ea24..ba2364e 100644 --- a/gluster/swift/common/exceptions.py +++ b/gluster/swift/common/exceptions.py @@ -44,3 +44,7 @@ class AlreadyExistsAsDir(GlusterfsException): class AlreadyExistsAsFile(GlusterfsException): pass + + +class DiskFileNoSpace(GlusterfsException): + pass |