Post Fuel deployment, remove default OpenStack network configuration which doesn't work with Calico.
Change-Id: I843cc94d787efe43f86ab73120b0c4ab4ed42a72
This commit is contained in:
parent
8cd61d75c1
commit
21cc049030
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This script removes default network config created in OpenStack as part of a
|
||||||
|
# Fuel deployment. These networks do not work for instance creation with
|
||||||
|
# Calico, so need to be removed.
|
||||||
|
|
||||||
|
# OpenStack authentication and authorization requires environment variables
|
||||||
|
# contained in the openrc file, this will allow us to issue commands via the
|
||||||
|
# neutron API.
|
||||||
|
source /root/openrc
|
||||||
|
|
||||||
|
# Details of the default networks/routers created on Fuel deployment of a
|
||||||
|
# Mirantis OpenStack environment.
|
||||||
|
DEFAULT_NET=net04
|
||||||
|
DEFAULT_NET_EXT=net04_ext
|
||||||
|
DEFAULT_ROUTER=router04
|
||||||
|
|
||||||
|
# DEFAULT_NET_EXT is set as the gateway for DEFAULT_ROUTER, we must clear that
|
||||||
|
# before we can delete the network.
|
||||||
|
neutron router-gateway-clear $DEFAULT_ROUTER
|
||||||
|
neutron net-delete $DEFAULT_NET_EXT
|
||||||
|
|
||||||
|
# DEFAULT_NET cannot be deleted until all ports configured on the network have
|
||||||
|
# been removed. We get details of the configured ports from the "neutron port-list"
|
||||||
|
# command, whose output is of the form:
|
||||||
|
# +-----+------+-------------------+-----------------------------------------------+
|
||||||
|
# | id | name | mac_address | fixed_ips |
|
||||||
|
# +-----+------+-------------------+-----------------------------------------------+
|
||||||
|
# | foo | | fa:16:3e:ae:70:4e | {"subnet_id": "bar", "ip_address": "a.b.c.d"} |
|
||||||
|
# +-----+------+-------------------+-----------------------------------------------+
|
||||||
|
port_ids=$(neutron port-list | grep "|" | grep -v "fixed_ips" | cut -d " " -f 2)
|
||||||
|
for port_id in "${port_ids[@]}"
|
||||||
|
do
|
||||||
|
neutron port-delete $port_id
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
# One of the ports is associated with the interface for the default router.
|
||||||
|
# This causes port deletion to fail. So we delete the interface on the
|
||||||
|
# router (this also removes the port).
|
||||||
|
neutron router-interface-delete $DEFAULT_ROUTER port=$port_id
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# We can now delete the default router and the default network.
|
||||||
|
neutron router-delete $DEFAULT_ROUTER
|
||||||
|
neutron net-delete $DEFAULT_NET
|
||||||
|
|
|
@ -16,6 +16,14 @@
|
||||||
cmd: ./calico_route_reflector.sh
|
cmd: ./calico_route_reflector.sh
|
||||||
timeout: 60
|
timeout: 60
|
||||||
|
|
||||||
|
# Remove default OpenStack network configuration which doesn't work with Calico.
|
||||||
|
- role: ['primary-controller']
|
||||||
|
stage: post_deployment/150
|
||||||
|
type: shell
|
||||||
|
parameters:
|
||||||
|
cmd: ./remove_default_networks.sh
|
||||||
|
timeout: 60
|
||||||
|
|
||||||
# Install/configure calico on the compute nodes after cluster deployment.
|
# Install/configure calico on the compute nodes after cluster deployment.
|
||||||
- role: ['compute']
|
- role: ['compute']
|
||||||
stage: post_deployment
|
stage: post_deployment
|
||||||
|
|
Loading…
Reference in New Issue