Skip to content

Commit

Permalink
Merge pull request #205 from dnegreira/fix-prodstack-fip
Browse files Browse the repository at this point in the history
fix FIP allocation on prodstack6
  • Loading branch information
dosaboy authored Jul 23, 2024
2 parents 44a29ec + bd4bee6 commit b4bf147
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions openstack/profiles/prodstack6
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ source ~/novarc
# this is currently assumed to be a /25 network
EXT_SUBNET=subnet_${OS_USERNAME}-psd-extra
CIDR=`openstack subnet show $EXT_SUBNET -c cidr -f value`
ABC=${CIDR%.0*}
# We reserve the last 64 of the /25 to FIP.
# We get the last usable IP on the subnet
FIP_RANGE_LASTIP=`openstack subnet show ${EXT_SUBNET} -c allocation_pools -f json | jq -r '.allocation_pools[0].end'`
# Get the first major subnet information, IE, 10.149.123 on a 10.149.123.0/25 subnet
SUBNET_RANGE=${FIP_RANGE_LASTIP%.*}

# We figure out from the last usable IP the last 64 usable IPs and concatenate it into the SUBNET_RANGE.
FIP_RANGE_FIRSTIP="${SUBNET_RANGE}.$((${FIP_RANGE_LASTIP##*.} - 64))"


export GATEWAY=`openstack subnet show $EXT_SUBNET -c gateway_ip -f value`

Expand All @@ -13,7 +21,7 @@ export GATEWAY=`openstack subnet show $EXT_SUBNET -c gateway_ip -f value`
# Set defaults, if not already set.
[[ -z "$GATEWAY" ]] && export GATEWAY="$GATEWAY"
[[ -z "$CIDR_EXT" ]] && export CIDR_EXT="$CIDR"
[[ -z "$FIP_RANGE" ]] && export FIP_RANGE="${ABC}.20:${ABC}.126"
[[ -z "$FIP_RANGE" ]] && export FIP_RANGE="${FIP_RANGE_FIRSTIP}:${FIP_RANGE_LASTIP}"
[[ -z "$CIDR_PRIV" ]] && export CIDR_PRIV="192.168.21.0/24"

export UNDERCLOUD_NETWORK_NAME="$(sed -E --quiet "s/.+OS_PROJECT_NAME=(.+)_project/net_\1-psd-extra/p" ~/novarc)"
Expand Down

0 comments on commit b4bf147

Please sign in to comment.