Skip to content

Commit

Permalink
Do not hardcode virtual bridge.
Browse files Browse the repository at this point in the history
Rather than hardcoding the virtual bridge an attempt is now made to
identify one that is not already in use.
  • Loading branch information
xsgordon committed Nov 9, 2012
1 parent 6964700 commit 86aae46
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rhev-ks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,24 @@ if [ ! -z "${EXISTING}" ]; then
exit 1
fi

# Find a virtual bridge name that is not in use.
BRIDGE=""
for N in {1..99}; do
ip addr show virbr${N} &> /dev/null
RESULT=$?
if [ $RESULT -eq 0 ]; then
continue
else BRIDGE="virbr${N}"
break
fi
done

# Define network example.com with only one IP available, which will be assigned to
# ${NAME}.example.com. This network config is what provides for the rhevm server
# having valid forward and reverse lookups.
echo "<network>
<name>example</name>
<bridge name='virbr10' />
<bridge name='${BRIDGE}' />
<forward mode='nat' />
<domain name='example.com' />
<dns>
Expand Down

0 comments on commit 86aae46

Please sign in to comment.