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 () {
# Main starts here
host=$(hostname)
domain=$(hostname -d)
INSTANCE=$GANETI_INSTANCE_NAME
hostname=$(hostname -f)
# Exit if we do not have instance name.
# It should be exported to hooks for instance related opcodes.
......@@ -89,7 +87,7 @@ if [ -z "$INSTANCE" ]; then
fi
# Run only in primary node of instance
if [ "$GANETI_INSTANCE_PRIMARY" != "$host.$domain" ]; then
if [ "$GANETI_INSTANCE_PRIMARY" != "$hostname" ]; then
exit 0
fi
......
......@@ -36,8 +36,7 @@
source /etc/default/snf-network
source /usr/lib/snf-network/common.sh
host=$(hostname)
domain=$(hostname -d)
hostname=$(hostname -f)
INSTANCE=$GANETI_INSTANCE_NAME
......@@ -62,13 +61,13 @@ for idx in $(seq $FIRST $LAST); do
for tag in $NETWORK_TAGS; do
case $tag in
$IP_LESS_ROUTED_TAG)
if [ "$GANETI_OLD_PRIMARY" == "$host.$domain" ]; then
if [ "$GANETI_OLD_PRIMARY" == "$hostname" ]; then
# This runs on the source node
# We invoke get_info here in order not to log
# and calculate things that are not needed eventually
get_info
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"
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