Update Vagrantfile to use networking-ovn with DevStack

This also allow to copy local project sources to
devstack target directory ($DEST) for provisioning
OpenStack with local changes.

Change-Id: I2002091b738e27eca4e14601027bc0f1f354c2c4
This commit is contained in:
Federico Ressi 2019-11-18 17:53:10 +01:00
parent 01e7654fdf
commit 3bda49671f
3 changed files with 129 additions and 5 deletions

20
Vagrantfile vendored
View File

@ -35,6 +35,15 @@ DEVSTACK_SRC_DIR = "#{DEVSTACK_DEST_DIR}/devstack"
# Host IP address to be assigned to OpenStack in DevStack
DEVSTACK_HOST_IP = "172.18.161.6"
# local.conf file to be used for DevStack provisioning (es local.conf)
DEVSTACK_CONF_FILENAME = 'local.conf' # 'ovn-local.conf'
# Local directory with local projects subdirs
LOCAL_PROJECT_DIR = '..'
# Local projects to be copied from LOCAL_PROJECT_DIR to DEVSTACK_DEST_DIR
LOCAL_PROJECT_NAMES = [] # ['devstack', 'networking-ovn']
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
@ -111,6 +120,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", privileged: false,
inline: "sudo mv ~/resolv.conf /etc/resolv.conf"
# Copy local project directories to DevStack DEST directory
for project_name in LOCAL_PROJECT_NAMES do
local_dir = "#{LOCAL_PROJECT_DIR}/#{project_name}"
if Dir.exist?(local_dir) then
target_dir = "#{DEVSTACK_DEST_DIR}/#{project_name}"
config.vm.synced_folder local_dir, target_dir, type: "rsync",
rsync__exclude: [".tox/"]
end
end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
@ -137,6 +156,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
export DEVSTACK_SRC_DIR=#{DEVSTACK_SRC_DIR}
export DEVSTACK_DEST_DIR=#{DEVSTACK_DEST_DIR}
export DEVSTACK_HOST_IP=#{DEVSTACK_HOST_IP}
export DEVSTACK_CONF_FILENAME=#{DEVSTACK_CONF_FILENAME}
' > ./provisionrc
sudo mv ./provisionrc '#{DEVSTACK_DEST_DIR}/provisionrc'

View File

@ -0,0 +1,97 @@
[[local|localrc]]
MULTI_HOST=0
# Configure IPS
HOST_IP=172.18.161.6
SERVICE_HOST=172.18.161.6
MYSQL_HOST=172.18.161.6
RABBIT_HOST=172.18.161.6
GLANCE_HOSTPORT=172.18.161.6:9292
# Configure passwords
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=secret
RABBIT_PASSWORD=secret
SERVICE_PASSWORD=secret
# Use python 3
USE_PYTHON3=true
# Configure Heat --------------------------------------------------------------
enable_plugin heat https://git.openstack.org/openstack/heat
# Configure Glance ------------------------------------------------------------
# download and register a VM image that heat can launch
# IMAGE_URL_SITE="https://download.fedoraproject.org"
# IMAGE_URL_PATH="/pub/fedora/linux/releases/29/Cloud/x86_64/images/"
# IMAGE_URL_FILE="Fedora-Cloud-Base-29-1.2.x86_64.qcow2"
# IMAGE_URLS+=","$IMAGE_URL_SITE$IMAGE_URL_PATH$IMAGE_URL_FILE
# Configure Nova --------------------------------------------------------------
# DEFAULT_INSTANCE_TYPE=ds512M
disable_service n-net
# Configure Neutron -----------------------------------------------------------
# Enable services that are required by OVN.
enable_plugin neutron https://opendev.org/openstack/neutron
enable_service q-svc
enable_service q-trunk
enable_service q-dns
#enable_service q-qos
# Disable Neutron agents not used with OVN.
disable_service q-agt
disable_service q-l3
disable_service q-dhcp
disable_service q-meta
# enable_service neutron
NETWORK_API_EXTENSIONS=address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details,uplink-status-propagation
## Neutron options
Q_USE_SECGROUP=True
FLOATING_RANGE="172.18.161.0/24"
IPV4_ADDRS_SAFE_TO_USE="10.0.0.0/22"
Q_FLOATING_ALLOCATION_POOL=start=172.18.161.200,end=172.18.161.254
PUBLIC_NETWORK_GATEWAY=172.18.161.1
PUBLIC_INTERFACE=eth1
# Open vSwitch provider networking configuration
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex
IP_VERSION=4
# enable IPv6
# IP_VERSION=4+6
# IPV6_RA_MODE=slaac
# IPV6_ADDRESS_MODE=slaac
# IPV6_ADDRS_SAFE_TO_USE=fd$IPV6_GLOBAL_ID::/56
# IPV6_PRIVATE_NETWORK_GATEWAY=fd$IPV6_GLOBAL_ID::1
# Configure OVN ---------------------------------------------------------------
enable_plugin networking-ovn https://opendev.org/openstack/networking-ovn
enable_service ovn-northd
enable_service ovn-controller
enable_service networking-ovn-metadata-agent
# Configure Octavia -----------------------------------------------------------
enable_plugin octavia https://opendev.org/openstack/octavia
ENABLED_SERVICES+=,octavia,o-cw,o-hk,o-hm,o-api
# Configure Tobiko ------------------------------------------------------------
enable_plugin tobiko /vagrant

View File

@ -2,6 +2,7 @@
set -eux
if [ -r "./provisionrc" ]; then
echo "Load parameters from RC file"
source "./provisionrc" || true
@ -16,23 +17,29 @@ export DEST=${DEVSTACK_DEST_DIR:-/opt/stack}
export DEVSTACK_SRC_DIR=${DEVSTACK_SRC_DIR:-${DEST}/devstack}
export TOBIKO_SRC_DIR=${TOBIKO_SRC_DIR:-/vagrant}
export HOST_IP=${DEVSTACK_HOST_IP:-172.18.161.6}
export DEVSTACK_CONF_FILENAME=${DEVSTACK_CONF_FILENAME:-local.conf}
echo "Provisioning DevStack on host $(hostname) as user ${USER}"
echo "Current directory is $(pwd)"
if ! [ -d "${DEVSTACK_SRC_DIR}" ]; then
echo "Make sure stack user has rigths to write to ${DEST} folder"
sudo chown -fR "${USER}.${USER}" "${DEST}"
sudo chmod ug+rwx "${DEST}"
if ! which git; then
echo "Install Git"
sudo yum install -y git
fi
if ! [ -d "${DEVSTACK_SRC_DIR}" ]; then
echo "Download DevStack source files from ${DEVSTACK_GIT_REPO}#${DEVSTACK_GIT_BRANCH}"
mkdir -p $(basename "${DEVSTACK_SRC_DIR}")
git clone "${DEVSTACK_GIT_REPO}" -b "${DEVSTACK_GIT_BRANCH}" "${DEVSTACK_SRC_DIR}"
fi
echo "Configure DevStack"
cp "${PROVISION_DIR}/local.conf" "${DEVSTACK_SRC_DIR}/"
cp "${PROVISION_DIR}/${DEVSTACK_CONF_FILENAME}" "${DEVSTACK_SRC_DIR}/local.conf"
cd "${DEVSTACK_SRC_DIR}"
echo "Run DevStack from directory: $(pwd)"