Skip to content

Commit f98191b

Browse files
author
Sheng Yang
committed
Fix domr's file lock
And add more information for domr's file lock
1 parent 495e9ad commit f98191b

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

‎patches/systemvm/debian/config/root/func.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ getLockFile() {
2424
return
2525
fi
2626

27-
touch $__LOCKFILE
27+
psline=`ps u $$`
28+
echo $psline > $__LOCKFILE
2829

2930
for i in `seq 1 $(($__TIMEOUT * 10))`
3031
do
@@ -43,8 +44,11 @@ getLockFile() {
4344
if [ $__locked -ne 1 ]
4445
then
4546
logger -t cloud "fail to acquire the lock $1 for process $0 pid $$ after $__TIMEOUT seconds time out!"
47+
cmd=`cat $currlock`
48+
logger -t cloud "waiting for command: $cmd"
4649
psline=`ps u $$`
4750
logger -t cloud "Failed job detail: $psline"
51+
rm $__LOCKFILE
4852
fi
4953
echo $__locked
5054
}

‎patches/systemvm/debian/config/root/ipassoc.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
260260
if [ $? -eq 0 ]
261261
then
262262
is_redundant=1
263-
sudo /root/checkrouter.sh|grep "Status: MASTER" > /dev/null 2>&1
263+
sudo /root/checkrouter.sh --no-lock|grep "Status: MASTER" > /dev/null 2>&1
264264
if [ $? -eq 0 ]
265265
then
266266
is_master=1

‎patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
source /root/func.sh
44

5-
lock="biglock"
6-
locked=$(getLockFile $lock)
7-
if [ "$locked" != "1" ]
5+
nolock=0
6+
if [ $# -eq 1 ]
87
then
9-
exit 1
8+
if [ $1 == "--no-lock" ]
9+
then
10+
nolock=1
11+
fi
12+
fi
13+
14+
if [ $nolock -eq 0 ]
15+
then
16+
lock="biglock"
17+
locked=$(getLockFile $lock)
18+
if [ "$locked" != "1" ]
19+
then
20+
exit 1
21+
fi
1022
fi
1123

1224
bumped="Bumped: NO"
@@ -21,4 +33,7 @@ then
2133
echo "$stat&$bumped"
2234
fi
2335

24-
unlock_exit $? $lock $locked
36+
if [ $nolock -eq 0 ]
37+
then
38+
unlock_exit $? $lock $locked
39+
fi

0 commit comments

Comments
 (0)