summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2018-06-12 09:51:44 +0200
committerShyamsundar Ranganathan <srangana@redhat.com>2018-06-20 17:38:45 +0000
commitacf0481bbf34e28d9aa850bd6c317b22bacae9bb (patch)
tree8a2d7d9c9ee80cf62ee0c24159ac47c00e27bdab
parent45edc547a827c4e38b7ec82de6d96e77ca5e593f (diff)
gcron: create the lockfile if it is missing
The lockfile for the job may not exist yet. If that is the case, it should be created upon the first time it is accessed. Change-Id: I4da2b3ecdb79cc63ed82cc7bfa026c8f08d4d043 Fixes: bz#1590195 Signed-off-by: Niels de Vos <ndevos@redhat.com> (cherry picked from commit 7005b1a336e483ec150c2f924a618dcfe197db0b)
-rwxr-xr-xextras/snap_scheduler/gcron.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py
index 853713275ce..3b5b0a7bb02 100755
--- a/extras/snap_scheduler/gcron.py
+++ b/extras/snap_scheduler/gcron.py
@@ -88,7 +88,7 @@ def takeSnap(volname="", snapname=""):
def doJob(name, lockFile, jobFunc, volname):
success = True
try:
- f = os.open(lockFile, os.O_RDWR | os.O_NONBLOCK)
+ f = os.open(lockFile, os.O_CREAT | os.O_RDWR | os.O_NONBLOCK)
try:
fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
mtime = os.path.getmtime(lockFile)