Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
palashvij-msft committed Aug 24, 2023
1 parent 540fb9f commit eb3e23d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 0 additions & 15 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ NORMAL="\e[0m"

HOSTNAME=$(hostname)

#
# For controlled warnings if Blob fqdn to IPv4 adddress present in etc/hosts
#
WARN_COUNTER=0

_log()
{
color=$1
Expand Down Expand Up @@ -151,16 +146,6 @@ resolve_ipv4()
local hname="$1"
local RETRIES=3

# Warn if the desired entry is present in /etc/hosts
if grep -q "$hname" /etc/hosts; then
((WARN_COUNTER++))
if ((WARN_COUNTER % 2 == 1)); then
wecho "[WARNING] Detected hard-coded resolution entry for "$hname" in /etc/hosts."
wecho "[Action Required]: To avoid conflicts and to ensure correctly handling endpoint IP address changes by AZNFS,
remove the entry for "$hname" in /etc/hosts."
fi
fi

# Some retries for resilience.
for((i=0;i<=$RETRIES;i++)) {
# Resolve hostname to IPv4 address.
Expand Down
15 changes: 15 additions & 0 deletions src/aznfswatchdog
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ AZNFS_TIMEWAIT_TIMEOUT="${AZNFS_TIMEWAIT_TIMEOUT:-65}"

next_ip_change_detection_epoch=0

#
# For controlled warnings if Blob fqdn to IPv4 address added in etc/hosts after mount
#
WARN_COUNTER=0

# Load common aznfs helpers.
. /opt/microsoft/aznfs/common.sh

Expand Down Expand Up @@ -308,6 +313,16 @@ while :; do
continue
fi

# Warn if the desired resolution entry is added in /etc/hosts after mount is success
if grep -q "$hname" /etc/hosts; then
((WARN_COUNTER++))
if ((WARN_COUNTER % 2 == 1)); then
wecho "[WARNING] Detected hard-coded resolution entry for "$hname" in /etc/hosts."
wecho "[Action Required]: To avoid conflicts and to ensure correctly handling endpoint IP address changes by AZNFS,
remove the entry for "$hname" in /etc/hosts."
fi
fi

#
# Check if blob endpoint IP address changed.
# This is the migration check.
Expand Down

0 comments on commit eb3e23d

Please sign in to comment.