summaryrefslogtreecommitdiffstats
path: root/extras/snap_scheduler
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-06-04 17:17:13 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-06-09 23:40:52 -0700
commitd835219a30327ede60e4ef28210914ab30bd0712 (patch)
tree8840bcd919cc98b29b911b07fe949cc5e02624cf /extras/snap_scheduler
parentcd6dc49fb3c4fabf4f1dbc4dcd57db7232939ce3 (diff)
snapshot/scheduler: Handle OSError in os. callbacks
Handle OSError and not IOError in os. callbacks. Change-Id: I2b5bfb629bacbd2d2e410d96034b4e2c11c4931e BUG: 1218060 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/11087 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'extras/snap_scheduler')
-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 ae5a84dacfa..09015c52f79 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(argv):
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(argv):
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(argv):
"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