Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | # |
| 15 | |
| 16 | # Global Sources |
| 17 | # -------------- |
| 18 | |
| 19 | # There are some ovs functions OVN depends on that must be sourced from |
| 20 | # the ovs neutron plugins. |
| 21 | source ${TOP_DIR}/lib/neutron_plugins/ovs_base |
| 22 | source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent |
| 23 | |
Ian Wienand | 7783563 | 2021-05-13 13:14:42 +1000 | [diff] [blame] | 24 | # Load devstack ovs compliation and loading functions |
| 25 | source ${TOP_DIR}/lib/neutron_plugins/ovs_source |
| 26 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 27 | # Set variables for building OVN from source |
| 28 | OVN_REPO=${OVN_REPO:-https://github.com/ovn-org/ovn.git} |
| 29 | OVN_REPO_NAME=$(basename ${OVN_REPO} | cut -f1 -d'.') |
| 30 | OVN_REPO_NAME=${OVN_REPO_NAME:-ovn} |
| 31 | OVN_BRANCH=${OVN_BRANCH:-v20.06.1} |
| 32 | # The commit removing OVN bits from the OVS tree, it is the commit that is not |
| 33 | # present in OVN tree and is used to distinguish if OVN is part of OVS or not. |
| 34 | # https://github.com/openvswitch/ovs/commit/05bf1dbb98b0635a51f75e268ef8aed27601401d |
| 35 | OVN_SPLIT_HASH=05bf1dbb98b0635a51f75e268ef8aed27601401d |
| 36 | |
| 37 | if is_service_enabled tls-proxy; then |
| 38 | OVN_PROTO=ssl |
| 39 | else |
| 40 | OVN_PROTO=tcp |
| 41 | fi |
| 42 | |
| 43 | # How to connect to ovsdb-server hosting the OVN SB database. |
| 44 | OVN_SB_REMOTE=${OVN_SB_REMOTE:-$OVN_PROTO:$SERVICE_HOST:6642} |
| 45 | |
| 46 | # How to connect to ovsdb-server hosting the OVN NB database |
| 47 | OVN_NB_REMOTE=${OVN_NB_REMOTE:-$OVN_PROTO:$SERVICE_HOST:6641} |
| 48 | |
| 49 | # ml2/config for neutron_sync_mode |
| 50 | OVN_NEUTRON_SYNC_MODE=${OVN_NEUTRON_SYNC_MODE:-log} |
| 51 | |
| 52 | # Configured DNS servers to be used with internal_dns extension, only |
| 53 | # if the subnet DNS is not configured. |
| 54 | OVN_DNS_SERVERS=${OVN_DNS_SERVERS:-8.8.8.8} |
| 55 | |
| 56 | # The type of OVN L3 Scheduler to use. The OVN L3 Scheduler determines the |
| 57 | # hypervisor/chassis where a routers gateway should be hosted in OVN. The |
| 58 | # default OVN L3 scheduler is leastloaded |
| 59 | OVN_L3_SCHEDULER=${OVN_L3_SCHEDULER:-leastloaded} |
| 60 | |
| 61 | # A UUID to uniquely identify this system. If one is not specified, a random |
| 62 | # one will be generated. A randomly generated UUID will be saved in a file |
Slawek Kaplonski | 1ed276c | 2021-03-11 13:10:28 +0100 | [diff] [blame] | 63 | # $OVS_SYSCONFDIR/system-id.conf (typically /etc/openvswitch/system-id.conf) |
| 64 | # so that the same one will be re-used if you re-run DevStack or restart |
| 65 | # Open vSwitch service. |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 66 | OVN_UUID=${OVN_UUID:-} |
| 67 | |
| 68 | # Whether or not to build the openvswitch kernel module from ovs. This is required |
| 69 | # unless the distro kernel includes ovs+conntrack support. |
| 70 | OVN_BUILD_MODULES=$(trueorfalse False OVN_BUILD_MODULES) |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 71 | OVN_BUILD_FROM_SOURCE=$(trueorfalse False OVN_BUILD_FROM_SOURCE) |
Slawek Kaplonski | 4185358 | 2021-07-06 12:05:31 +0200 | [diff] [blame] | 72 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 73 | Q_BUILD_OVS_FROM_GIT=True |
| 74 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 75 | |
| 76 | # Whether or not to install the ovs python module from ovs source. This can be |
| 77 | # used to test and validate new ovs python features. This should only be used |
| 78 | # for development purposes since the ovs python version is controlled by OpenStack |
| 79 | # requirements. |
| 80 | OVN_INSTALL_OVS_PYTHON_MODULE=$(trueorfalse False OVN_INSTALL_OVS_PYTHON_MODULE) |
| 81 | |
| 82 | # GENEVE overlay protocol overhead. Defaults to 38 bytes plus the IP version |
| 83 | # overhead (20 bytes for IPv4 (default) or 40 bytes for IPv6) which is determined |
| 84 | # based on the ML2 overlay_ip_version option. The ML2 framework will use this to |
| 85 | # configure the MTU DHCP option. |
| 86 | OVN_GENEVE_OVERHEAD=${OVN_GENEVE_OVERHEAD:-38} |
| 87 | |
Lucas Alvares Gomes | e38a39a | 2021-05-14 09:14:24 +0100 | [diff] [blame] | 88 | # The log level of the OVN databases (north and south). |
| 89 | # Supported log levels are: off, emer, err, warn, info or dbg. |
| 90 | # More information about log levels can be found at |
| 91 | # http://www.openvswitch.org/support/dist-docs/ovs-appctl.8.txt |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 92 | OVN_DBS_LOG_LEVEL=${OVN_DBS_LOG_LEVEL:-info} |
| 93 | |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 94 | # OVN metadata agent configuration |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 95 | OVN_META_CONF=$NEUTRON_CONF_DIR/neutron_ovn_metadata_agent.ini |
| 96 | OVN_META_DATA_HOST=${OVN_META_DATA_HOST:-$(ipv6_unquote $SERVICE_HOST)} |
| 97 | |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 98 | # OVN agent configuration |
| 99 | OVN_AGENT_CONF=$NEUTRON_CONF_DIR/plugins/ml2/ovn_agent.ini |
| 100 | OVN_AGENT_EXTENSIONS=${OVN_AGENT_EXTENSIONS:-} |
| 101 | |
Lucas Alvares Gomes | e38a39a | 2021-05-14 09:14:24 +0100 | [diff] [blame] | 102 | # If True (default) the node will be considered a gateway node. |
| 103 | ENABLE_CHASSIS_AS_GW=$(trueorfalse True ENABLE_CHASSIS_AS_GW) |
Lucas Alvares Gomes | 22038a9 | 2021-05-27 13:44:20 +0100 | [diff] [blame] | 104 | OVN_L3_CREATE_PUBLIC_NETWORK=$(trueorfalse True OVN_L3_CREATE_PUBLIC_NETWORK) |
Lucas Alvares Gomes | e38a39a | 2021-05-14 09:14:24 +0100 | [diff] [blame] | 105 | |
Lucas Alvares Gomes | 6ecfe67 | 2020-09-23 11:54:19 +0100 | [diff] [blame] | 106 | export OVSDB_SERVER_LOCAL_HOST=$SERVICE_LOCAL_HOST |
Brian Haley | c869d59 | 2020-02-28 14:55:08 -0500 | [diff] [blame] | 107 | TUNNEL_IP=$TUNNEL_ENDPOINT_IP |
Lucas Alvares Gomes | 6ecfe67 | 2020-09-23 11:54:19 +0100 | [diff] [blame] | 108 | if [[ "$SERVICE_IP_VERSION" == 6 ]]; then |
| 109 | OVSDB_SERVER_LOCAL_HOST=[$OVSDB_SERVER_LOCAL_HOST] |
Brian Haley | c869d59 | 2020-02-28 14:55:08 -0500 | [diff] [blame] | 110 | TUNNEL_IP=[$TUNNEL_IP] |
Lucas Alvares Gomes | 6ecfe67 | 2020-09-23 11:54:19 +0100 | [diff] [blame] | 111 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 112 | |
| 113 | OVN_IGMP_SNOOPING_ENABLE=$(trueorfalse False OVN_IGMP_SNOOPING_ENABLE) |
| 114 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 115 | OVS_PREFIX= |
| 116 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 117 | OVS_PREFIX=/usr/local |
| 118 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 119 | OVS_SBINDIR=$OVS_PREFIX/sbin |
| 120 | OVS_BINDIR=$OVS_PREFIX/bin |
| 121 | OVS_RUNDIR=$OVS_PREFIX/var/run/openvswitch |
| 122 | OVS_SHAREDIR=$OVS_PREFIX/share/openvswitch |
| 123 | OVS_SCRIPTDIR=$OVS_SHAREDIR/scripts |
| 124 | OVS_DATADIR=$DATA_DIR/ovs |
Rodolfo Alonso Hernandez | 30819e6 | 2021-03-22 07:14:50 +0000 | [diff] [blame] | 125 | OVS_SYSCONFDIR=${OVS_SYSCONFDIR:-$OVS_PREFIX/etc/openvswitch} |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 126 | |
Gregory Thiemonge | 6822ff3 | 2021-09-01 09:36:31 +0200 | [diff] [blame] | 127 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 128 | OVN_DATADIR=$DATA_DIR/ovn |
| 129 | else |
| 130 | # When using OVN from packages, the data dir for OVN DBs is |
| 131 | # /var/lib/ovn |
| 132 | OVN_DATADIR=/var/lib/ovn |
| 133 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 134 | OVN_SHAREDIR=$OVS_PREFIX/share/ovn |
| 135 | OVN_SCRIPTDIR=$OVN_SHAREDIR/scripts |
| 136 | OVN_RUNDIR=$OVS_PREFIX/var/run/ovn |
| 137 | |
| 138 | NEUTRON_OVN_BIN_DIR=$(get_python_exec_prefix) |
| 139 | NEUTRON_OVN_METADATA_BINARY="neutron-ovn-metadata-agent" |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 140 | NEUTRON_OVN_AGENT_BINARY="neutron-ovn-agent" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 141 | |
| 142 | STACK_GROUP="$( id --group --name "$STACK_USER" )" |
| 143 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 144 | OVN_NORTHD_SERVICE=ovn-northd.service |
| 145 | if is_ubuntu; then |
| 146 | # The ovn-central.service file on Ubuntu is responsible for starting |
| 147 | # ovn-northd and the OVN DBs (on CentOS this is done by ovn-northd.service) |
| 148 | OVN_NORTHD_SERVICE=ovn-central.service |
| 149 | fi |
| 150 | OVSDB_SERVER_SERVICE=ovsdb-server.service |
| 151 | OVS_VSWITCHD_SERVICE=ovs-vswitchd.service |
| 152 | OVN_CONTROLLER_SERVICE=ovn-controller.service |
| 153 | OVN_CONTROLLER_VTEP_SERVICE=ovn-controller-vtep.service |
| 154 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 155 | OVSDB_SERVER_SERVICE=devstack@ovsdb-server.service |
| 156 | OVS_VSWITCHD_SERVICE=devstack@ovs-vswitchd.service |
| 157 | OVN_NORTHD_SERVICE=devstack@ovn-northd.service |
| 158 | OVN_CONTROLLER_SERVICE=devstack@ovn-controller.service |
| 159 | OVN_CONTROLLER_VTEP_SERVICE=devstack@ovn-controller-vtep.service |
| 160 | fi |
| 161 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 162 | # Defaults Overwrite |
| 163 | # ------------------ |
| 164 | |
| 165 | Q_ML2_PLUGIN_MECHANISM_DRIVERS=${Q_ML2_PLUGIN_MECHANISM_DRIVERS:-ovn,logger} |
| 166 | Q_ML2_PLUGIN_TYPE_DRIVERS=${Q_ML2_PLUGIN_TYPE_DRIVERS:-local,flat,vlan,geneve} |
| 167 | Q_ML2_TENANT_NETWORK_TYPE=${Q_ML2_TENANT_NETWORK_TYPE:-"geneve"} |
| 168 | Q_ML2_PLUGIN_GENEVE_TYPE_OPTIONS=${Q_ML2_PLUGIN_GENEVE_TYPE_OPTIONS:-"vni_ranges=1:65536"} |
Lucas Alvares Gomes | e7625fc | 2020-08-26 09:46:35 +0100 | [diff] [blame] | 169 | Q_ML2_PLUGIN_EXT_DRIVERS=${Q_ML2_PLUGIN_EXT_DRIVERS:-port_security,qos} |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 170 | # this one allows empty: |
| 171 | ML2_L3_PLUGIN=${ML2_L3_PLUGIN-"ovn-router"} |
| 172 | |
Flavio Fernandes | a2273cc | 2021-02-06 16:23:36 -0500 | [diff] [blame] | 173 | Q_LOG_DRIVER_RATE_LIMIT=${Q_LOG_DRIVER_RATE_LIMIT:-100} |
| 174 | Q_LOG_DRIVER_BURST_LIMIT=${Q_LOG_DRIVER_BURST_LIMIT:-25} |
| 175 | Q_LOG_DRIVER_LOG_BASE=${Q_LOG_DRIVER_LOG_BASE:-acl_log_meter} |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 176 | |
| 177 | # Utility Functions |
| 178 | # ----------------- |
| 179 | |
yatinkarel | 1baa890 | 2022-05-06 17:53:54 +0530 | [diff] [blame] | 180 | function wait_for_db_file { |
| 181 | local count=0 |
| 182 | while [ ! -f $1 ]; do |
| 183 | sleep 1 |
| 184 | count=$((count+1)) |
Dr. Jens Harbott | bd6e520 | 2022-07-03 22:27:15 +0200 | [diff] [blame] | 185 | if [ "$count" -gt 40 ]; then |
yatinkarel | 1baa890 | 2022-05-06 17:53:54 +0530 | [diff] [blame] | 186 | die $LINENO "DB File $1 not found" |
| 187 | fi |
| 188 | done |
| 189 | } |
| 190 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 191 | function wait_for_sock_file { |
| 192 | local count=0 |
| 193 | while [ ! -S $1 ]; do |
| 194 | sleep 1 |
| 195 | count=$((count+1)) |
Dr. Jens Harbott | bd6e520 | 2022-07-03 22:27:15 +0200 | [diff] [blame] | 196 | if [ "$count" -gt 40 ]; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 197 | die $LINENO "Socket $1 not found" |
| 198 | fi |
| 199 | done |
| 200 | } |
| 201 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 202 | function use_new_ovn_repository { |
Lucas Alvares Gomes | e38a39a | 2021-05-14 09:14:24 +0100 | [diff] [blame] | 203 | if [[ "$OVN_BUILD_FROM_SOURCE" == "False" ]]; then |
| 204 | return 0 |
| 205 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 206 | if [ -z "$is_new_ovn" ]; then |
| 207 | local ovs_repo_dir=$DEST/$OVS_REPO_NAME |
| 208 | if [ ! -d $ovs_repo_dir ]; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 209 | git_timed clone $OVS_REPO $ovs_repo_dir |
| 210 | pushd $ovs_repo_dir |
| 211 | git checkout $OVS_BRANCH |
| 212 | popd |
| 213 | else |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 214 | clone_repository $OVS_REPO $ovs_repo_dir $OVS_BRANCH |
| 215 | fi |
| 216 | # Check the split commit exists in the current branch |
| 217 | pushd $ovs_repo_dir |
| 218 | git log $OVS_BRANCH --pretty=format:"%H" | grep -q $OVN_SPLIT_HASH |
| 219 | is_new_ovn=$? |
| 220 | popd |
| 221 | fi |
| 222 | return $is_new_ovn |
| 223 | } |
| 224 | |
| 225 | # NOTE(rtheis): Function copied from DevStack _neutron_ovs_base_setup_bridge |
| 226 | # and _neutron_ovs_base_add_bridge with the call to neutron-ovs-cleanup |
| 227 | # removed. The call is not relevant for OVN, as it is specific to the use |
| 228 | # of Neutron's OVS agent and hangs when running stack.sh because |
| 229 | # neutron-ovs-cleanup uses the OVSDB native interface. |
| 230 | function ovn_base_setup_bridge { |
| 231 | local bridge=$1 |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 232 | local addbr_cmd="sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge -- set bridge $bridge protocols=OpenFlow13,OpenFlow15" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 233 | |
| 234 | if [ "$OVS_DATAPATH_TYPE" != "system" ] ; then |
| 235 | addbr_cmd="$addbr_cmd -- set Bridge $bridge datapath_type=${OVS_DATAPATH_TYPE}" |
| 236 | fi |
| 237 | |
| 238 | $addbr_cmd |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 239 | sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | function _start_process { |
| 243 | $SYSTEMCTL daemon-reload |
| 244 | $SYSTEMCTL enable $1 |
| 245 | $SYSTEMCTL restart $1 |
| 246 | } |
| 247 | |
| 248 | function _run_process { |
| 249 | local service=$1 |
| 250 | local cmd="$2" |
| 251 | local stop_cmd="$3" |
| 252 | local group=$4 |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 253 | local user=$5 |
| 254 | local rundir=${6:-$OVS_RUNDIR} |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 255 | |
| 256 | local systemd_service="devstack@$service.service" |
| 257 | local unit_file="$SYSTEMD_DIR/$systemd_service" |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 258 | local environment="OVN_RUNDIR=$OVN_RUNDIR OVN_DBDIR=$OVN_DATADIR OVN_LOGDIR=$LOGDIR OVS_RUNDIR=$OVS_RUNDIR OVS_DBDIR=$OVS_DATADIR OVS_LOGDIR=$LOGDIR" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 259 | |
| 260 | echo "Starting $service executed command": $cmd |
| 261 | |
| 262 | write_user_unit_file $systemd_service "$cmd" "$group" "$user" |
| 263 | iniset -sudo $unit_file "Service" "Type" "forking" |
| 264 | iniset -sudo $unit_file "Service" "RemainAfterExit" "yes" |
| 265 | iniset -sudo $unit_file "Service" "KillMode" "mixed" |
| 266 | iniset -sudo $unit_file "Service" "LimitNOFILE" "65536" |
| 267 | iniset -sudo $unit_file "Service" "Environment" "$environment" |
| 268 | if [ -n "$stop_cmd" ]; then |
| 269 | iniset -sudo $unit_file "Service" "ExecStop" "$stop_cmd" |
| 270 | fi |
| 271 | |
| 272 | _start_process $systemd_service |
| 273 | |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 274 | local testcmd="test -e $rundir/$service.pid" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 275 | test_with_retry "$testcmd" "$service did not start" $SERVICE_TIMEOUT 1 |
Rodolfo Alonso Hernandez | 8c67103 | 2022-02-09 18:01:46 +0000 | [diff] [blame] | 276 | local service_ctl_file |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 277 | service_ctl_file=$(ls $rundir | grep $service | grep ctl) |
Rodolfo Alonso Hernandez | 8c67103 | 2022-02-09 18:01:46 +0000 | [diff] [blame] | 278 | if [ -z "$service_ctl_file" ]; then |
| 279 | die $LINENO "ctl file for service $service is not present." |
| 280 | fi |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 281 | sudo ovs-appctl -t $rundir/$service_ctl_file vlog/set console:off syslog:info file:info |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | function clone_repository { |
| 285 | local repo=$1 |
| 286 | local dir=$2 |
| 287 | local branch=$3 |
| 288 | # Set ERROR_ON_CLONE to false to avoid the need of having the |
| 289 | # repositories like OVN and OVS in the required_projects of the job |
| 290 | # definition. |
| 291 | ERROR_ON_CLONE=false git_clone $repo $dir $branch |
| 292 | } |
| 293 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 294 | function create_public_bridge { |
| 295 | # Create the public bridge that OVN will use |
Radosław Piliszek | 9529878 | 2021-06-08 16:19:40 +0000 | [diff] [blame] | 296 | sudo ovs-vsctl --may-exist add-br $PUBLIC_BRIDGE -- set bridge $PUBLIC_BRIDGE protocols=OpenFlow13,OpenFlow15 |
Harald Jensås | 16ac21f | 2023-08-31 15:06:52 +0200 | [diff] [blame] | 297 | sudo ovs-vsctl set open . external-ids:ovn-bridge-mappings=${OVN_BRIDGE_MAPPINGS} |
Slawek Kaplonski | b1a89eb | 2021-08-26 21:42:32 +0200 | [diff] [blame] | 298 | _configure_public_network_connectivity |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | function _disable_libvirt_apparmor { |
| 302 | if ! sudo aa-status --enabled ; then |
| 303 | return 0 |
| 304 | fi |
| 305 | # NOTE(arosen): This is used as a work around to allow newer versions |
| 306 | # of libvirt to work with ovs configured ports. See LP#1466631. |
| 307 | # requires the apparmor-utils |
| 308 | install_package apparmor-utils |
| 309 | # disables apparmor for libvirtd |
| 310 | sudo aa-complain /etc/apparmor.d/usr.sbin.libvirtd |
| 311 | } |
| 312 | |
| 313 | |
| 314 | # OVN compilation functions |
| 315 | # ------------------------- |
| 316 | |
| 317 | |
| 318 | # compile_ovn() - Compile OVN from source and load needed modules |
| 319 | # Accepts three parameters: |
Slawek Kaplonski | 5888947 | 2021-12-22 16:00:29 +0100 | [diff] [blame] | 320 | # - first optional parameter defines prefix for |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 321 | # ovn compilation |
Slawek Kaplonski | 5888947 | 2021-12-22 16:00:29 +0100 | [diff] [blame] | 322 | # - second optional parameter defines localstatedir for |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 323 | # ovn single machine runtime |
| 324 | function compile_ovn { |
Slawek Kaplonski | 5888947 | 2021-12-22 16:00:29 +0100 | [diff] [blame] | 325 | local prefix=$1 |
| 326 | local localstatedir=$2 |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 327 | |
| 328 | if [ -n "$prefix" ]; then |
| 329 | prefix="--prefix=$prefix" |
| 330 | fi |
| 331 | |
| 332 | if [ -n "$localstatedir" ]; then |
| 333 | localstatedir="--localstatedir=$localstatedir" |
| 334 | fi |
| 335 | |
| 336 | clone_repository $OVN_REPO $DEST/$OVN_REPO_NAME $OVN_BRANCH |
| 337 | pushd $DEST/$OVN_REPO_NAME |
| 338 | |
| 339 | if [ ! -f configure ] ; then |
| 340 | ./boot.sh |
| 341 | fi |
| 342 | |
Mohammed Naser | 7fa2475 | 2022-04-20 15:42:43 -0400 | [diff] [blame] | 343 | # NOTE(mnaser): OVN requires that you build using the OVS from the |
| 344 | # submodule. |
| 345 | # |
| 346 | # https://github.com/ovn-org/ovn/blob/3fb397b63663297acbcbf794e1233951222ae5af/Documentation/intro/install/general.rst#bootstrapping |
| 347 | # https://github.com/ovn-org/ovn/issues/128 |
| 348 | git submodule update --init |
| 349 | pushd ovs |
| 350 | if [ ! -f configure ] ; then |
| 351 | ./boot.sh |
| 352 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 353 | if [ ! -f config.status ] || [ configure -nt config.status ] ; then |
Mohammed Naser | 7fa2475 | 2022-04-20 15:42:43 -0400 | [diff] [blame] | 354 | ./configure |
| 355 | fi |
| 356 | make -j$(($(nproc) + 1)) |
| 357 | popd |
| 358 | |
| 359 | if [ ! -f config.status ] || [ configure -nt config.status ] ; then |
| 360 | ./configure $prefix $localstatedir |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 361 | fi |
| 362 | make -j$(($(nproc) + 1)) |
| 363 | sudo make install |
| 364 | popd |
| 365 | } |
| 366 | |
| 367 | |
| 368 | # OVN Neutron driver functions |
| 369 | # ---------------------------- |
| 370 | |
| 371 | # OVN service sanity check |
| 372 | function ovn_sanity_check { |
Slawek Kaplonski | a52041c | 2022-11-18 11:39:56 +0100 | [diff] [blame] | 373 | if is_service_enabled q-agt neutron-agent; then |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 374 | die $LINENO "The q-agt/neutron-agt service must be disabled with OVN." |
| 375 | elif is_service_enabled q-l3 neutron-l3; then |
| 376 | die $LINENO "The q-l3/neutron-l3 service must be disabled with OVN." |
| 377 | elif is_service_enabled q-svc neutron-api && [[ ! $Q_ML2_PLUGIN_MECHANISM_DRIVERS =~ "ovn" ]]; then |
| 378 | die $LINENO "OVN needs to be enabled in \$Q_ML2_PLUGIN_MECHANISM_DRIVERS" |
| 379 | elif is_service_enabled q-svc neutron-api && [[ ! $Q_ML2_PLUGIN_TYPE_DRIVERS =~ "geneve" ]]; then |
| 380 | die $LINENO "Geneve needs to be enabled in \$Q_ML2_PLUGIN_TYPE_DRIVERS to be used with OVN" |
| 381 | fi |
| 382 | } |
| 383 | |
| 384 | # install_ovn() - Collect source and prepare |
| 385 | function install_ovn { |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 386 | echo "Installing OVN and dependent packages" |
| 387 | |
| 388 | # Check the OVN configuration |
| 389 | ovn_sanity_check |
| 390 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 391 | # Install tox, used to generate the config (see devstack/override-defaults) |
| 392 | pip_install tox |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 393 | |
| 394 | sudo mkdir -p $OVS_RUNDIR |
| 395 | sudo chown $(whoami) $OVS_RUNDIR |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 396 | |
| 397 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 398 | # If OVS is already installed, remove it, because we're about to |
| 399 | # re-install it from source. |
| 400 | for package in openvswitch openvswitch-switch openvswitch-common; do |
| 401 | if is_package_installed $package ; then |
| 402 | uninstall_package $package |
| 403 | fi |
| 404 | done |
| 405 | |
| 406 | remove_ovs_packages |
| 407 | sudo rm -f $OVS_RUNDIR/* |
| 408 | |
| 409 | compile_ovs $OVN_BUILD_MODULES |
| 410 | if use_new_ovn_repository; then |
Slawek Kaplonski | 5888947 | 2021-12-22 16:00:29 +0100 | [diff] [blame] | 411 | compile_ovn |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 412 | fi |
| 413 | |
| 414 | sudo mkdir -p $OVS_PREFIX/var/log/openvswitch |
| 415 | sudo chown $(whoami) $OVS_PREFIX/var/log/openvswitch |
| 416 | sudo mkdir -p $OVS_PREFIX/var/log/ovn |
| 417 | sudo chown $(whoami) $OVS_PREFIX/var/log/ovn |
| 418 | else |
yatinkarel | 6dd896f | 2022-04-26 16:37:07 +0530 | [diff] [blame] | 419 | # Load fixup_ovn_centos |
| 420 | source ${TOP_DIR}/tools/fixup_stuff.sh |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 421 | fixup_ovn_centos |
| 422 | install_package $(get_packages openvswitch) |
| 423 | install_package $(get_packages ovn) |
| 424 | fi |
| 425 | |
| 426 | # Ensure that the OVS commands are accessible in the PATH |
| 427 | export PATH=$OVS_BINDIR:$PATH |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 428 | |
| 429 | # Archive log files and create new |
| 430 | local log_archive_dir=$LOGDIR/archive |
| 431 | mkdir -p $log_archive_dir |
| 432 | for logfile in ovs-vswitchd.log ovn-northd.log ovn-controller.log ovn-controller-vtep.log ovs-vtep.log ovsdb-server.log ovsdb-server-nb.log ovsdb-server-sb.log; do |
| 433 | if [ -f "$LOGDIR/$logfile" ] ; then |
| 434 | mv "$LOGDIR/$logfile" "$log_archive_dir/$logfile.${CURRENT_LOG_TIME}" |
| 435 | fi |
| 436 | done |
| 437 | |
| 438 | # Install ovsdbapp from source if requested |
| 439 | if use_library_from_git "ovsdbapp"; then |
| 440 | git_clone_by_name "ovsdbapp" |
| 441 | setup_dev_lib "ovsdbapp" |
| 442 | fi |
| 443 | |
| 444 | # Install ovs python module from ovs source. |
| 445 | if [[ "$OVN_INSTALL_OVS_PYTHON_MODULE" == "True" ]]; then |
| 446 | sudo pip uninstall -y ovs |
| 447 | # Clone the OVS repository if it's not yet present |
| 448 | clone_repository $OVS_REPO $DEST/$OVS_REPO_NAME $OVS_BRANCH |
| 449 | sudo pip install -e $DEST/$OVS_REPO_NAME/python |
| 450 | fi |
| 451 | } |
| 452 | |
| 453 | # filter_network_api_extensions() - Remove non-supported API extensions by |
| 454 | # the OVN driver from the list of enabled API extensions |
| 455 | function filter_network_api_extensions { |
| 456 | SUPPORTED_NETWORK_API_EXTENSIONS=$($PYTHON -c \ |
| 457 | 'from neutron.common.ovn import extensions ;\ |
| 458 | print(",".join(extensions.ML2_SUPPORTED_API_EXTENSIONS))') |
| 459 | SUPPORTED_NETWORK_API_EXTENSIONS=$SUPPORTED_NETWORK_API_EXTENSIONS,$($PYTHON -c \ |
| 460 | 'from neutron.common.ovn import extensions ;\ |
| 461 | print(",".join(extensions.ML2_SUPPORTED_API_EXTENSIONS_OVN_L3))') |
| 462 | if is_service_enabled q-qos neutron-qos ; then |
| 463 | SUPPORTED_NETWORK_API_EXTENSIONS="$SUPPORTED_NETWORK_API_EXTENSIONS,qos" |
| 464 | fi |
| 465 | NETWORK_API_EXTENSIONS=${NETWORK_API_EXTENSIONS:-$SUPPORTED_NETWORK_API_EXTENSIONS} |
| 466 | extensions=$(echo $NETWORK_API_EXTENSIONS | tr ', ' '\n' | sort -u) |
| 467 | supported_ext=$(echo $SUPPORTED_NETWORK_API_EXTENSIONS | tr ', ' '\n' | sort -u) |
| 468 | enabled_ext=$(comm -12 <(echo -e "$extensions") <(echo -e "$supported_ext")) |
| 469 | disabled_ext=$(comm -3 <(echo -e "$extensions") <(echo -e "$enabled_ext")) |
| 470 | |
| 471 | # Log a message in case some extensions had to be disabled because |
| 472 | # they are not supported by the OVN driver |
| 473 | if [ ! -z "$disabled_ext" ]; then |
| 474 | _disabled=$(echo $disabled_ext | tr ' ' ',') |
| 475 | echo "The folling network API extensions have been disabled because they are not supported by OVN: $_disabled" |
| 476 | fi |
| 477 | |
| 478 | # Export the final list of extensions that have been enabled and are |
| 479 | # supported by OVN |
| 480 | export NETWORK_API_EXTENSIONS=$(echo $enabled_ext | tr ' ' ',') |
| 481 | } |
| 482 | |
| 483 | function configure_ovn_plugin { |
| 484 | echo "Configuring Neutron for OVN" |
| 485 | |
Slawek Kaplonski | a52041c | 2022-11-18 11:39:56 +0100 | [diff] [blame] | 486 | if is_service_enabled q-svc neutron-api; then |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 487 | filter_network_api_extensions |
| 488 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_type_geneve max_header_size=$OVN_GENEVE_OVERHEAD |
| 489 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_connection="$OVN_NB_REMOTE" |
| 490 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_connection="$OVN_SB_REMOTE" |
| 491 | if is_service_enabled tls-proxy; then |
| 492 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_ca_cert="$INT_CA_DIR/ca-chain.pem" |
| 493 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_certificate="$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt" |
| 494 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_private_key="$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key" |
| 495 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_ca_cert="$INT_CA_DIR/ca-chain.pem" |
| 496 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_certificate="$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt" |
| 497 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_private_key="$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key" |
| 498 | fi |
| 499 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn neutron_sync_mode="$OVN_NEUTRON_SYNC_MODE" |
| 500 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_l3_scheduler="$OVN_L3_SCHEDULER" |
| 501 | populate_ml2_config /$Q_PLUGIN_CONF_FILE securitygroup enable_security_group="$Q_USE_SECGROUP" |
| 502 | inicomment /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver |
| 503 | |
Flavio Fernandes | a2273cc | 2021-02-06 16:23:36 -0500 | [diff] [blame] | 504 | if is_service_enabled q-log neutron-log; then |
| 505 | populate_ml2_config /$Q_PLUGIN_CONF_FILE network_log rate_limit="$Q_LOG_DRIVER_RATE_LIMIT" |
| 506 | populate_ml2_config /$Q_PLUGIN_CONF_FILE network_log burst_limit="$Q_LOG_DRIVER_BURST_LIMIT" |
| 507 | inicomment /$Q_PLUGIN_CONF_FILE network_log local_output_log_base="$Q_LOG_DRIVER_LOG_BASE" |
| 508 | fi |
| 509 | |
Slawek Kaplonski | a52041c | 2022-11-18 11:39:56 +0100 | [diff] [blame] | 510 | if is_service_enabled q-ovn-metadata-agent neutron-ovn-metadata-agent; then |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 511 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=True |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 512 | elif is_service_enabled q-ovn-agent neutron-ovn-agent && [[ "$OVN_AGENT_EXTENSIONS" =~ 'metadata' ]]; then |
| 513 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=True |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 514 | else |
| 515 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=False |
| 516 | fi |
| 517 | |
| 518 | if is_service_enabled q-dns neutron-dns ; then |
| 519 | iniset $NEUTRON_CONF DEFAULT dns_domain openstackgate.local |
| 520 | populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn dns_servers="$OVN_DNS_SERVERS" |
| 521 | fi |
| 522 | |
| 523 | iniset $NEUTRON_CONF ovs igmp_snooping_enable $OVN_IGMP_SNOOPING_ENABLE |
| 524 | fi |
| 525 | |
| 526 | if is_service_enabled q-dhcp neutron-dhcp ; then |
| 527 | iniset $NEUTRON_CONF DEFAULT dhcp_agent_notification True |
| 528 | else |
| 529 | iniset $NEUTRON_CONF DEFAULT dhcp_agent_notification False |
| 530 | fi |
| 531 | |
| 532 | if is_service_enabled n-api-meta ; then |
Slawek Kaplonski | a52041c | 2022-11-18 11:39:56 +0100 | [diff] [blame] | 533 | if is_service_enabled q-ovn-metadata-agent neutron-ovn-metadata-agent; then |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 534 | iniset $NOVA_CONF neutron service_metadata_proxy True |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 535 | elif is_service_enabled q-ovn-agent neutron-ovn-agent && [[ "$OVN_AGENT_EXTENSIONS" =~ 'metadata' ]]; then |
| 536 | iniset $NOVA_CONF neutron service_metadata_proxy True |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 537 | fi |
| 538 | fi |
| 539 | } |
| 540 | |
| 541 | function configure_ovn { |
| 542 | echo "Configuring OVN" |
| 543 | |
| 544 | if [ -z "$OVN_UUID" ] ; then |
Slawek Kaplonski | 1ed276c | 2021-03-11 13:10:28 +0100 | [diff] [blame] | 545 | if [ -f $OVS_SYSCONFDIR/system-id.conf ]; then |
| 546 | OVN_UUID=$(cat $OVS_SYSCONFDIR/system-id.conf) |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 547 | else |
| 548 | OVN_UUID=$(uuidgen) |
Slawek Kaplonski | 1ed276c | 2021-03-11 13:10:28 +0100 | [diff] [blame] | 549 | echo $OVN_UUID | sudo tee $OVS_SYSCONFDIR/system-id.conf |
| 550 | fi |
| 551 | else |
| 552 | local ovs_uuid |
| 553 | ovs_uuid=$(cat $OVS_SYSCONFDIR/system-id.conf) |
| 554 | if [ "$ovs_uuid" != $OVN_UUID ]; then |
| 555 | echo $OVN_UUID | sudo tee $OVS_SYSCONFDIR/system-id.conf |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 556 | fi |
| 557 | fi |
| 558 | |
Lucas Alvares Gomes | 8903d8c | 2021-01-15 09:26:44 +0000 | [diff] [blame] | 559 | # Erase the pre-set configurations from packages. DevStack will |
| 560 | # configure OVS and OVN accordingly for its use. |
| 561 | if [[ "$OVN_BUILD_FROM_SOURCE" == "False" ]] && is_fedora; then |
| 562 | sudo truncate -s 0 /etc/openvswitch/default.conf |
| 563 | sudo truncate -s 0 /etc/sysconfig/openvswitch |
| 564 | sudo truncate -s 0 /etc/sysconfig/ovn |
| 565 | fi |
| 566 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 567 | # Metadata |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 568 | local sample_file="" |
| 569 | local config_file="" |
| 570 | if is_service_enabled q-ovn-agent neutron-ovn-agent && [[ "$OVN_AGENT_EXTENSIONS" =~ 'metadata' ]] && is_service_enabled ovn-controller; then |
| 571 | sample_file=$NEUTRON_DIR/etc/neutron/plugins/ml2/ovn_agent.ini.sample |
| 572 | config_file=$OVN_AGENT_CONF |
| 573 | elif is_service_enabled q-ovn-metadata-agent neutron-ovn-metadata-agent && is_service_enabled ovn-controller; then |
| 574 | sample_file=$NEUTRON_DIR/etc/neutron_ovn_metadata_agent.ini.sample |
| 575 | config_file=$OVN_META_CONF |
| 576 | fi |
Jaromir Wysoglad | c336b87 | 2024-03-27 11:36:26 +0100 | [diff] [blame] | 577 | if [ -n "$config_file" ]; then |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 578 | sudo install -d -o $STACK_USER $NEUTRON_CONF_DIR |
| 579 | |
| 580 | mkdir -p $NEUTRON_DIR/etc/neutron/plugins/ml2 |
| 581 | (cd $NEUTRON_DIR && exec ./tools/generate_config_file_samples.sh) |
| 582 | |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 583 | cp $sample_file $config_file |
| 584 | configure_root_helper_options $config_file |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 585 | |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 586 | iniset $config_file DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
| 587 | iniset $config_file DEFAULT nova_metadata_host $OVN_META_DATA_HOST |
| 588 | iniset $config_file DEFAULT metadata_workers $API_WORKERS |
| 589 | iniset $config_file DEFAULT state_path $DATA_DIR/neutron |
| 590 | iniset $config_file ovs ovsdb_connection tcp:$OVSDB_SERVER_LOCAL_HOST:6640 |
| 591 | iniset $config_file ovn ovn_sb_connection $OVN_SB_REMOTE |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 592 | if is_service_enabled tls-proxy; then |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 593 | iniset $config_file ovn \ |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 594 | ovn_sb_ca_cert $INT_CA_DIR/ca-chain.pem |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 595 | iniset $config_file ovn \ |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 596 | ovn_sb_certificate $INT_CA_DIR/$DEVSTACK_CERT_NAME.crt |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 597 | iniset $config_file ovn \ |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 598 | ovn_sb_private_key $INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key |
| 599 | fi |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 600 | if [[ $config_file == $OVN_AGENT_CONF ]]; then |
| 601 | iniset $config_file agent extensions $OVN_AGENT_EXTENSIONS |
| 602 | iniset $config_file ovn ovn_nb_connection $OVN_NB_REMOTE |
| 603 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 604 | fi |
| 605 | } |
| 606 | |
| 607 | function init_ovn { |
| 608 | # clean up from previous (possibly aborted) runs |
| 609 | # create required data files |
| 610 | |
| 611 | # Assumption: this is a dedicated test system and there is nothing important |
| 612 | # in the ovn, ovn-nb, or ovs databases. We're going to trash them and |
| 613 | # create new ones on each devstack run. |
| 614 | |
| 615 | _disable_libvirt_apparmor |
Roman Dobosz | bd68251 | 2021-11-26 15:34:50 +0100 | [diff] [blame] | 616 | local mkdir_cmd="mkdir -p ${OVN_DATADIR}" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 617 | |
Roman Dobosz | bd68251 | 2021-11-26 15:34:50 +0100 | [diff] [blame] | 618 | if [[ "$OVN_BUILD_FROM_SOURCE" == "False" ]]; then |
| 619 | mkdir_cmd="sudo ${mkdir_cmd}" |
yatinkarel | b575af0 | 2021-11-26 12:44:41 +0530 | [diff] [blame] | 620 | fi |
Roman Dobosz | bd68251 | 2021-11-26 15:34:50 +0100 | [diff] [blame] | 621 | |
| 622 | $mkdir_cmd |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 623 | mkdir -p $OVS_DATADIR |
| 624 | |
| 625 | rm -f $OVS_DATADIR/*.db |
| 626 | rm -f $OVS_DATADIR/.*.db.~lock~ |
Gregory Thiemonge | 6822ff3 | 2021-09-01 09:36:31 +0200 | [diff] [blame] | 627 | sudo rm -f $OVN_DATADIR/*.db |
| 628 | sudo rm -f $OVN_DATADIR/.*.db.~lock~ |
yatinkarel | 7fecba2 | 2023-01-12 17:31:36 +0530 | [diff] [blame] | 629 | sudo rm -f $OVN_RUNDIR/*.sock |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 630 | } |
| 631 | |
| 632 | function _start_ovs { |
| 633 | echo "Starting OVS" |
| 634 | if is_service_enabled ovn-controller ovn-controller-vtep ovn-northd; then |
| 635 | # ovsdb-server and ovs-vswitchd are used privately in OVN as openvswitch service names. |
| 636 | enable_service ovsdb-server |
| 637 | enable_service ovs-vswitchd |
| 638 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 639 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 640 | if [ ! -f $OVS_DATADIR/conf.db ]; then |
| 641 | ovsdb-tool create $OVS_DATADIR/conf.db $OVS_SHAREDIR/vswitch.ovsschema |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 642 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 643 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 644 | if is_service_enabled ovn-controller-vtep; then |
| 645 | if [ ! -f $OVS_DATADIR/vtep.db ]; then |
| 646 | ovsdb-tool create $OVS_DATADIR/vtep.db $OVS_SHAREDIR/vtep.ovsschema |
| 647 | fi |
| 648 | fi |
| 649 | |
| 650 | local dbcmd="$OVS_SBINDIR/ovsdb-server --remote=punix:$OVS_RUNDIR/db.sock --remote=ptcp:6640:$OVSDB_SERVER_LOCAL_HOST --pidfile --detach --log-file" |
| 651 | dbcmd+=" --remote=db:Open_vSwitch,Open_vSwitch,manager_options" |
| 652 | if is_service_enabled ovn-controller-vtep; then |
| 653 | dbcmd+=" --remote=db:hardware_vtep,Global,managers $OVS_DATADIR/vtep.db" |
| 654 | fi |
| 655 | dbcmd+=" $OVS_DATADIR/conf.db" |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 656 | _run_process ovsdb-server "$dbcmd" "" "$STACK_GROUP" "root" "$OVS_RUNDIR" |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 657 | |
| 658 | # Note: ovn-controller will create and configure br-int once it is started. |
| 659 | # So, no need to create it now because nothing depends on that bridge here. |
| 660 | local ovscmd="$OVS_SBINDIR/ovs-vswitchd --log-file --pidfile --detach" |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 661 | _run_process ovs-vswitchd "$ovscmd" "" "$STACK_GROUP" "root" "$OVS_RUNDIR" |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 662 | else |
| 663 | _start_process "$OVSDB_SERVER_SERVICE" |
| 664 | _start_process "$OVS_VSWITCHD_SERVICE" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 665 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 666 | |
| 667 | echo "Configuring OVSDB" |
| 668 | if is_service_enabled tls-proxy; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 669 | sudo ovs-vsctl --no-wait set-ssl \ |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 670 | $INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key \ |
| 671 | $INT_CA_DIR/$DEVSTACK_CERT_NAME.crt \ |
| 672 | $INT_CA_DIR/ca-chain.pem |
| 673 | fi |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 674 | |
| 675 | sudo ovs-vsctl --no-wait set-manager ptcp:6640:$OVSDB_SERVER_LOCAL_HOST |
| 676 | sudo ovs-vsctl --no-wait set open_vswitch . system-type="devstack" |
| 677 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:system-id="$OVN_UUID" |
| 678 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-remote="$OVN_SB_REMOTE" |
| 679 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-bridge="br-int" |
| 680 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-type="geneve" |
Brian Haley | c869d59 | 2020-02-28 14:55:08 -0500 | [diff] [blame] | 681 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-ip="$TUNNEL_IP" |
Vladislav Belogrudov | 8a38a73 | 2022-05-25 12:58:52 +0300 | [diff] [blame] | 682 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:hostname=$(hostname) |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 683 | # Select this chassis to host gateway routers |
| 684 | if [[ "$ENABLE_CHASSIS_AS_GW" == "True" ]]; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 685 | sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-cms-options="enable-chassis-as-gw" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 686 | fi |
| 687 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 688 | if is_provider_network || [[ $Q_USE_PROVIDERNET_FOR_PUBLIC == "True" ]]; then |
| 689 | ovn_base_setup_bridge $OVS_PHYSICAL_BRIDGE |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 690 | sudo ovs-vsctl set open . external-ids:ovn-bridge-mappings=${PHYSICAL_NETWORK}:${OVS_PHYSICAL_BRIDGE} |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 691 | fi |
| 692 | |
| 693 | if is_service_enabled ovn-controller-vtep ; then |
| 694 | ovn_base_setup_bridge br-v |
| 695 | vtep-ctl add-ps br-v |
Brian Haley | c869d59 | 2020-02-28 14:55:08 -0500 | [diff] [blame] | 696 | vtep-ctl set Physical_Switch br-v tunnel_ips=$TUNNEL_IP |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 697 | |
| 698 | enable_service ovs-vtep |
| 699 | local vtepcmd="$OVS_SCRIPTDIR/ovs-vtep --log-file --pidfile --detach br-v" |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 700 | _run_process ovs-vtep "$vtepcmd" "" "$STACK_GROUP" "root" "$OVS_RUNDIR" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 701 | |
| 702 | vtep-ctl set-manager tcp:$HOST_IP:6640 |
| 703 | fi |
| 704 | fi |
| 705 | } |
| 706 | |
Fernando Royo | a976168 | 2024-12-04 16:44:52 +0100 | [diff] [blame^] | 707 | function _wait_for_ovn_and_set_custom_config { |
| 708 | # Wait for the service to be ready |
| 709 | # Check for socket and db files for both OVN NB and SB |
| 710 | wait_for_sock_file $OVN_RUNDIR/ovnnb_db.sock |
| 711 | wait_for_sock_file $OVN_RUNDIR/ovnsb_db.sock |
| 712 | wait_for_db_file $OVN_DATADIR/ovnnb_db.db |
| 713 | wait_for_db_file $OVN_DATADIR/ovnsb_db.db |
| 714 | |
| 715 | if is_service_enabled tls-proxy; then |
| 716 | sudo ovn-nbctl --db=unix:$OVN_RUNDIR/ovnnb_db.sock set-ssl $INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key $INT_CA_DIR/$DEVSTACK_CERT_NAME.crt $INT_CA_DIR/ca-chain.pem |
| 717 | sudo ovn-sbctl --db=unix:$OVN_RUNDIR/ovnsb_db.sock set-ssl $INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key $INT_CA_DIR/$DEVSTACK_CERT_NAME.crt $INT_CA_DIR/ca-chain.pem |
| 718 | fi |
| 719 | |
| 720 | sudo ovn-nbctl --db=unix:$OVN_RUNDIR/ovnnb_db.sock set-connection p${OVN_PROTO}:6641:$SERVICE_LISTEN_ADDRESS -- set connection . inactivity_probe=60000 |
| 721 | sudo ovn-sbctl --db=unix:$OVN_RUNDIR/ovnsb_db.sock set-connection p${OVN_PROTO}:6642:$SERVICE_LISTEN_ADDRESS -- set connection . inactivity_probe=60000 |
| 722 | sudo ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl vlog/set console:off syslog:$OVN_DBS_LOG_LEVEL file:$OVN_DBS_LOG_LEVEL |
| 723 | sudo ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl vlog/set console:off syslog:$OVN_DBS_LOG_LEVEL file:$OVN_DBS_LOG_LEVEL |
| 724 | } |
| 725 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 726 | # start_ovn() - Start running processes, including screen |
| 727 | function start_ovn { |
| 728 | echo "Starting OVN" |
| 729 | |
| 730 | _start_ovs |
| 731 | |
| 732 | local SCRIPTDIR=$OVN_SCRIPTDIR |
| 733 | if ! use_new_ovn_repository; then |
| 734 | SCRIPTDIR=$OVS_SCRIPTDIR |
| 735 | fi |
| 736 | |
| 737 | if is_service_enabled ovn-northd ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 738 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 739 | local cmd="/bin/bash $SCRIPTDIR/ovn-ctl --no-monitor start_northd" |
| 740 | local stop_cmd="/bin/bash $SCRIPTDIR/ovn-ctl stop_northd" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 741 | |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 742 | _run_process ovn-northd "$cmd" "$stop_cmd" "$STACK_GROUP" "root" "$OVN_RUNDIR" |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 743 | else |
| 744 | _start_process "$OVN_NORTHD_SERVICE" |
| 745 | fi |
| 746 | |
Fernando Royo | a976168 | 2024-12-04 16:44:52 +0100 | [diff] [blame^] | 747 | _wait_for_ovn_and_set_custom_config |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 748 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 749 | fi |
| 750 | |
| 751 | if is_service_enabled ovn-controller ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 752 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 753 | local cmd="/bin/bash $SCRIPTDIR/ovn-ctl --no-monitor start_controller" |
| 754 | local stop_cmd="/bin/bash $SCRIPTDIR/ovn-ctl stop_controller" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 755 | |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 756 | _run_process ovn-controller "$cmd" "$stop_cmd" "$STACK_GROUP" "root" "$OVN_RUNDIR" |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 757 | else |
| 758 | _start_process "$OVN_CONTROLLER_SERVICE" |
| 759 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 760 | fi |
| 761 | |
| 762 | if is_service_enabled ovn-controller-vtep ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 763 | if [[ "$OVN_BUILD_FROM_SOURCE" == "True" ]]; then |
| 764 | local cmd="$OVS_BINDIR/ovn-controller-vtep --log-file --pidfile --detach --ovnsb-db=$OVN_SB_REMOTE" |
Brian Haley | 71c9965 | 2022-10-19 14:08:43 -0400 | [diff] [blame] | 765 | _run_process ovn-controller-vtep "$cmd" "" "$STACK_GROUP" "root" "$OVN_RUNDIR" |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 766 | else |
| 767 | _start_process "$OVN_CONTROLLER_VTEP_SERVICE" |
| 768 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 769 | fi |
| 770 | |
Slawek Kaplonski | a52041c | 2022-11-18 11:39:56 +0100 | [diff] [blame] | 771 | if is_service_enabled q-ovn-metadata-agent neutron-ovn-metadata-agent; then |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 772 | run_process q-ovn-metadata-agent "$NEUTRON_OVN_BIN_DIR/$NEUTRON_OVN_METADATA_BINARY --config-file $OVN_META_CONF" |
| 773 | # Format logging |
| 774 | setup_logging $OVN_META_CONF |
| 775 | fi |
| 776 | |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 777 | if is_service_enabled q-ovn-agent neutron-ovn-agent; then |
| 778 | run_process q-ovn-agent "$NEUTRON_OVN_BIN_DIR/$NEUTRON_OVN_AGENT_BINARY --config-file $OVN_AGENT_CONF" |
| 779 | # Format logging |
| 780 | setup_logging $OVN_AGENT_CONF |
| 781 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | function _stop_ovs_dp { |
| 785 | sudo ovs-dpctl dump-dps | sudo xargs -n1 ovs-dpctl del-dp |
| 786 | modprobe -q -r vport_geneve vport_vxlan openvswitch || true |
| 787 | } |
| 788 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 789 | function _stop_process { |
| 790 | local service=$1 |
| 791 | echo "Stopping process $service" |
| 792 | if $SYSTEMCTL is-enabled $service; then |
| 793 | $SYSTEMCTL stop $service |
| 794 | $SYSTEMCTL disable $service |
| 795 | fi |
| 796 | } |
| 797 | |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 798 | function stop_ovn { |
Slawek Kaplonski | a52041c | 2022-11-18 11:39:56 +0100 | [diff] [blame] | 799 | if is_service_enabled q-ovn-metadata-agent neutron-ovn-metadata-agent; then |
Bence Romsics | 71c3c40 | 2022-12-21 13:50:54 +0100 | [diff] [blame] | 800 | # pkill takes care not to kill itself, but it may kill its parent |
| 801 | # sudo unless we use the "ps | grep [f]oo" trick |
| 802 | sudo pkill -9 -f "[h]aproxy" || : |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 803 | _stop_process "devstack@q-ovn-metadata-agent.service" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 804 | fi |
Rodolfo Alonso Hernandez | 6091df2 | 2023-12-20 23:06:18 +0000 | [diff] [blame] | 805 | if is_service_enabled q-ovn-agent neutron-ovn-agent; then |
| 806 | # pkill takes care not to kill itself, but it may kill its parent |
| 807 | # sudo unless we use the "ps | grep [f]oo" trick |
| 808 | sudo pkill -9 -f "[h]aproxy" || : |
| 809 | _stop_process "devstack@q-ovn-agent.service" |
| 810 | fi |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 811 | if is_service_enabled ovn-controller-vtep ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 812 | _stop_process "$OVN_CONTROLLER_VTEP_SERVICE" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 813 | fi |
| 814 | if is_service_enabled ovn-controller ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 815 | _stop_process "$OVN_CONTROLLER_SERVICE" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 816 | fi |
| 817 | if is_service_enabled ovn-northd ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 818 | _stop_process "$OVN_NORTHD_SERVICE" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 819 | fi |
| 820 | if is_service_enabled ovs-vtep ; then |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 821 | _stop_process "devstack@ovs-vtep.service" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 822 | fi |
| 823 | |
Lucas Alvares Gomes | e651d9e | 2020-11-19 14:50:01 +0000 | [diff] [blame] | 824 | _stop_process "$OVS_VSWITCHD_SERVICE" |
| 825 | _stop_process "$OVSDB_SERVER_SERVICE" |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 826 | |
| 827 | _stop_ovs_dp |
| 828 | } |
| 829 | |
| 830 | function _cleanup { |
| 831 | local path=${1:-$DEST/$OVN_REPO_NAME} |
| 832 | pushd $path |
| 833 | cd $path |
| 834 | sudo make uninstall |
| 835 | sudo make distclean |
| 836 | popd |
| 837 | } |
| 838 | |
| 839 | # cleanup_ovn() - Remove residual data files, anything left over from previous |
| 840 | # runs that a clean run would need to clean up |
| 841 | function cleanup_ovn { |
| 842 | local ovn_path=$DEST/$OVN_REPO_NAME |
| 843 | local ovs_path=$DEST/$OVS_REPO_NAME |
| 844 | |
| 845 | if [ -d $ovn_path ]; then |
| 846 | _cleanup $ovn_path |
| 847 | fi |
| 848 | |
| 849 | if [ -d $ovs_path ]; then |
| 850 | _cleanup $ovs_path |
| 851 | fi |
| 852 | |
Artur Angiel | bfbd2be | 2022-04-10 11:31:21 +0200 | [diff] [blame] | 853 | sudo rm -rf $OVN_RUNDIR |
Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 854 | } |