Commit a2ab1424 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

Use hostname -f to get node FQDN

Ganeti exports node names with their FQDN. Use hostname -f
to compare the exported variables and decide whether to execute
the hook or not.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 45951b41
...@@ -77,10 +77,8 @@ update_dns () { ...@@ -77,10 +77,8 @@ update_dns () {
# Main starts here # Main starts here
host=$(hostname)
domain=$(hostname -d)
INSTANCE=$GANETI_INSTANCE_NAME INSTANCE=$GANETI_INSTANCE_NAME
hostname=$(hostname -f)
# Exit if we do not have instance name. # Exit if we do not have instance name.
# It should be exported to hooks for instance related opcodes. # It should be exported to hooks for instance related opcodes.
...@@ -89,7 +87,7 @@ if [ -z "$INSTANCE" ]; then ...@@ -89,7 +87,7 @@ if [ -z "$INSTANCE" ]; then
fi fi
# Run only in primary node of instance # Run only in primary node of instance
if [ "$GANETI_INSTANCE_PRIMARY" != "$host.$domain" ]; then if [ "$GANETI_INSTANCE_PRIMARY" != "$hostname" ]; then
exit 0 exit 0
fi fi
......
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
source /etc/default/snf-network source /etc/default/snf-network
source /usr/lib/snf-network/common.sh source /usr/lib/snf-network/common.sh
host=$(hostname) hostname=$(hostname -f)
domain=$(hostname -d)
INSTANCE=$GANETI_INSTANCE_NAME INSTANCE=$GANETI_INSTANCE_NAME
...@@ -62,13 +61,13 @@ for idx in $(seq $FIRST $LAST); do ...@@ -62,13 +61,13 @@ for idx in $(seq $FIRST $LAST); do
for tag in $NETWORK_TAGS; do for tag in $NETWORK_TAGS; do
case $tag in case $tag in
$IP_LESS_ROUTED_TAG) $IP_LESS_ROUTED_TAG)
if [ "$GANETI_OLD_PRIMARY" == "$host.$domain" ]; then if [ "$GANETI_OLD_PRIMARY" == "$hostname" ]; then
# This runs on the source node # This runs on the source node
# We invoke get_info here in order not to log # We invoke get_info here in order not to log
# and calculate things that are not needed eventually # and calculate things that are not needed eventually
get_info get_info
delete_neighbor_proxy delete_neighbor_proxy
elif [ "$GANETI_NEW_PRIMARY" == "$host.$domain" ]; then elif [ "$GANETI_NEW_PRIMARY" == "$hostname" ]; then
$SNF_NETWORK_LOG $0 "Do nothing in new primary. All done by if-up script" $SNF_NETWORK_LOG $0 "Do nothing in new primary. All done by if-up script"
fi fi
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment