diff options
author | Avra Sengupta <asengupt@redhat.com> | 2015-04-29 12:02:05 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-04-30 01:28:16 -0700 |
commit | 0be5e3d7c580f77f3db0d4282d2ac81071ccd3f5 (patch) | |
tree | ce2d1bed013a9adbebaf0cbcd13992a5cdcdbcae | |
parent | 3d0c87a38802b0751c79ec0f11bb7f8972f417cd (diff) |
snapshot/scheduler: Use shutil.move instead of os.rename()
os.rename is a wrapper on top of the rename function,
which fails with invalid cross-device link if /tmp
is a tmpfs. Hence using shutil.move
Change-Id: Ia026d2a810b725ccd398db895e612c53bc6a2f95
BUG: 1214574
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10347
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rwxr-xr-x | extras/snap_scheduler/snap_scheduler.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py index 7353e4f2df7..8aa65b6c9ae 100755 --- a/extras/snap_scheduler/snap_scheduler.py +++ b/extras/snap_scheduler/snap_scheduler.py @@ -17,6 +17,7 @@ import argparse import fcntl import logging.handlers import sys +import shutil from errno import EEXIST @@ -234,7 +235,7 @@ def write_tasks_to_file(): ret = False return ret - os.rename(TMP_FILE, GCRON_ENABLED) + shutil.move(TMP_FILE, GCRON_ENABLED) ret = True return ret @@ -346,7 +347,7 @@ def initialise_scheduler(): ret = False return ret - os.rename("/tmp/crontab", GCRON_UPDATE_TASK) + shutil.move("/tmp/crontab", GCRON_UPDATE_TASK) if not os.path.lexists(GCRON_TASKS): try: |