Skip to content

Commit 937f5ce

Browse files
committed
add IP change detection for EIT
1 parent c27b80f commit 937f5ce

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/aznfswatchdogv4

+26-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ process_nfsv4_mounts()
129129
#
130130
#findmnt=$(findmnt | grep 'nfs4\|$LOCALHOST' 2>&1)
131131
findmnt=$(findmnt --raw --noheading -o MAJ:MIN,FSTYPE,SOURCE,TARGET,OPTIONS -t nfs 2>&1)
132-
132+
#daniewo use this findmnt to check against the fslocation file for the IP
133133

134134
#
135135
# For no matching mounts also, findmnt exits with a failure return, so check
@@ -168,6 +168,8 @@ process_nfsv4_mounts()
168168
accept_port=$(cat $l_conf | grep accept | cut -d ':' -f 2)
169169
vecho "accept_port: $accept_port"
170170

171+
172+
171173
#
172174
# Delete entry from MOUNTMAPv4 if there are no mounted shares on that host.
173175
# As long as we have at least one mount using the MOUNTMAPv4 entry, we leave
@@ -199,6 +201,29 @@ process_nfsv4_mounts()
199201
# above
200202

201203

204+
#daniewo get dest ip from mountmap file
205+
ip_address=$(echo $l_conf | awk -F'.file' '{print $1}')
206+
echo "The extracted IP address is: $ip_address"
207+
208+
#get matching ip address from fs location entry for the account name FQDN
209+
local fslocation_entry=$(grep -m1 $l_host $VIRTUALFSLOCATION)
210+
#probably need to check if it returns empty as well.
211+
212+
eecho "daniewo fslocation_entry = $fslocation_entry"
213+
214+
215+
216+
217+
#extract fslocation entry
218+
IFS=" " read l_fqdn new_ip l_prt <<< $fslocation_entry
219+
eecho "daniewo $l_fqdn, $new_ip, $l_prt"
220+
221+
222+
# check fslocation ip against the old ip that was in mountmap file
223+
if [ "$ip_address" != "$new_ip" ]; then
224+
eecho "daniewwo IP for $l_host changed [$l_nfsip -> $new_ip]."
225+
fi
226+
202227
# Check if checksumHash for stunnel.conf file has changed.
203228
# Customers should not modify stunnel.conf files created by aznfs mount helper.
204229
checksumHash=`cksum $l_conf | awk '{print $1}'`

0 commit comments

Comments
 (0)