summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-06-04 17:17:13 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-06-11 05:00:41 -0700
commit013994da53831d2ee3d36714256ae9b3b109ffee (patch)
tree36bff5c2004d81aa8dfbc12ef4dc1a2391a9d379
parent04722f44fd05ce8b247e18034c1e261a7734a827 (diff)
snapshot/scheduler: Handle OSError in os. callbacks
Backport of http://review.gluster.org/#/c/11087/ Handle OSError and not IOError in os. callbacks. Change-Id: I2b5bfb629bacbd2d2e410d96034b4e2c11c4931e BUG: 1230018 Signed-off-by: Avra Sengupta <asengupt@redhat.com> (cherry picked from commit d835219a30327ede60e4ef28210914ab30bd0712) Reviewed-on: http://review.gluster.org/11151 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rwxr-xr-xextras/snap_scheduler/snap_scheduler.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py
index 1c5f9380dd8..b6929803320 100755
--- a/extras/snap_scheduler/snap_scheduler.py
+++ b/extras/snap_scheduler/snap_scheduler.py
@@ -129,7 +129,7 @@ def enable_scheduler():
f = os.open(GCRON_ENABLED, os.O_CREAT | os.O_NONBLOCK,
0644)
os.close(f)
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
log.error("Failed to open %s. Error: %s.",
GCRON_ENABLED, strerror)
ret = INTERNAL_ERROR
@@ -139,7 +139,7 @@ def enable_scheduler():
log.info("Snapshot scheduling is enabled")
output("Snapshot scheduling is enabled")
ret = 0
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
print_str = "Failed to enable snapshot scheduling. Error: "+strerror
log.error(print_str)
output(print_str)
@@ -188,7 +188,7 @@ def disable_scheduler():
log.info("Snapshot scheduling is disabled")
output("Snapshot scheduling is disabled")
ret = 0
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
print_str = "Failed to disable snapshot scheduling. Error: "+strerror
log.error(print_str)
output(print_str)
@@ -343,7 +343,7 @@ def add_schedules(jobname, schedule, volname):
try:
f = os.open(job_lockfile, os.O_CREAT | os.O_NONBLOCK, 0644)
os.close(f)
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
log.error("Failed to open %s. Error: %s.",
job_lockfile, strerror)
ret = INTERNAL_ERROR
@@ -372,7 +372,7 @@ def delete_schedules(jobname):
job_lockfile = LOCK_FILE_DIR+jobname
try:
os.remove(job_lockfile)
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
log.error("Failed to open %s. Error: %s.",
job_lockfile, strerror)
ret = INTERNAL_ERROR
@@ -630,7 +630,7 @@ def main():
if not os.path.exists(SHARED_STORAGE_DIR+"/snaps/"):
try:
os.makedirs(SHARED_STORAGE_DIR+"/snaps/")
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
if errno != EEXIST:
log.error("Failed to create %s : %s", SHARED_STORAGE_DIR+"/snaps/", strerror)
output("Failed to create %s. Error: %s"
@@ -644,7 +644,7 @@ def main():
if not os.path.exists(LOCK_FILE_DIR):
try:
os.makedirs(LOCK_FILE_DIR)
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
if errno != EEXIST:
log.error("Failed to create %s : %s", LOCK_FILE_DIR, strerror)
output("Failed to create %s. Error: %s"
@@ -666,7 +666,7 @@ def main():
"Please try again after some time.")
return ANOTHER_TRANSACTION_IN_PROGRESS
os.close(f)
- except IOError as (errno, strerror):
+ except OSError as (errno, strerror):
log.error("Failed to open %s : %s", LOCK_FILE, strerror)
output("Failed to open %s. Error: %s" % (LOCK_FILE, strerror))
return INTERNAL_ERROR