Create Vagrantfile for manual testing via DevStack
Change-Id: I47d7976fc6bb2027da7879e36a358f1fc15c46c2
This commit is contained in:
parent
822cf1592c
commit
c5abb62a4d
131
Vagrantfile
vendored
Normal file
131
Vagrantfile
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
# Customize the count of CPU cores on the VM
|
||||
CPUS = 2
|
||||
|
||||
# Customize the amount of memory on the VM
|
||||
MEMORY = 8192
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://vagrantcloud.com/search.
|
||||
BOX = "generic/ubuntu1604"
|
||||
|
||||
HOSTNAME = "tobiko"
|
||||
|
||||
# Directory where Vagrantfile directory is copied or mounted to the VM
|
||||
TOBIKO_SRC_DIR = "/vagrant"
|
||||
|
||||
# Default prefix to OpenStack Git repositories
|
||||
OPENSTACK_GIT_BASE = "https://git.openstack.org"
|
||||
|
||||
# DevStack Git repo URL and branch
|
||||
DEVSTACK_GIT_REPO = "#{OPENSTACK_GIT_BASE}/openstack-dev/devstack"
|
||||
DEVSTACK_GIT_BRANCH = "stable/queens"
|
||||
|
||||
# DevStack destination directory
|
||||
DEVSTACK_DEST_DIR = "/opt/stack"
|
||||
|
||||
# DevStack source file directory
|
||||
DEVSTACK_SRC_DIR = "#{DEVSTACK_DEST_DIR}/devstack"
|
||||
|
||||
# Host IP address to be assigned to OpenStack in DevStack
|
||||
DEVSTACK_HOST_IP = "172.18.161.6"
|
||||
|
||||
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
config.vm.box = BOX
|
||||
config.vm.hostname = HOSTNAME
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
# NOTE: This will enable public access to the opened port
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine and only allow access
|
||||
# via 127.0.0.1 to disable public access
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
config.vm.network "private_network", ip: DEVSTACK_HOST_IP
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network", ip: "172.18.161.6"
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
# Display the VirtualBox GUI when booting the machine
|
||||
vb.gui = false
|
||||
|
||||
vb.cpus = CPUS
|
||||
vb.memory = MEMORY
|
||||
end
|
||||
|
||||
config.vm.provider "libvirt" do |libvirt|
|
||||
libvirt.cpus = CPUS
|
||||
libvirt.memory = MEMORY
|
||||
end
|
||||
|
||||
config.vm.synced_folder ".", "/vagrant", type: "rsync"
|
||||
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options.
|
||||
|
||||
# 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.
|
||||
config.vm.provision "shell", privileged: false, inline: <<-SHELL
|
||||
set -uex
|
||||
if ! sudo su - stack; then
|
||||
# setup stack user
|
||||
sudo useradd -s /bin/bash -d '#{DEVSTACK_DEST_DIR}' -m stack
|
||||
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
|
||||
fi
|
||||
|
||||
# Generate provision RC file to pass variables to provision script
|
||||
sudo echo '
|
||||
export TOBIKO_SRC_DIR=#{TOBIKO_SRC_DIR}
|
||||
export OPENSTACK_GIT_BASE=#{OPENSTACK_GIT_BASE}
|
||||
export DEVSTACK_GIT_REPO=#{DEVSTACK_GIT_REPO}
|
||||
export DEVSTACK_GIT_BRANCH=#{DEVSTACK_GIT_BRANCH}
|
||||
export DEVSTACK_SRC_DIR=#{DEVSTACK_SRC_DIR}
|
||||
export DEVSTACK_DEST_DIR=#{DEVSTACK_DEST_DIR}
|
||||
export DEVSTACK_HOST_IP=#{DEVSTACK_HOST_IP}
|
||||
' > ./provisionrc
|
||||
sudo mv ./provisionrc '#{DEVSTACK_DEST_DIR}/provisionrc'
|
||||
|
||||
# Execute provision script as stack user
|
||||
sudo su -l stack -c '#{TOBIKO_SRC_DIR}/devstack/vagrant/provision.bash'
|
||||
SHELL
|
||||
end
|
45
devstack/vagrant/local.conf
Normal file
45
devstack/vagrant/local.conf
Normal file
@ -0,0 +1,45 @@
|
||||
[[local|localrc]]
|
||||
|
||||
# Configure passwords
|
||||
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
|
||||
ADMIN_PASSWORD=secret
|
||||
DATABASE_PASSWORD=secret
|
||||
RABBIT_PASSWORD=secret
|
||||
SERVICE_PASSWORD=secret
|
||||
|
||||
# User python 3
|
||||
USE_PYTHON3=true
|
||||
|
||||
# Enable tobiko plugin
|
||||
enable_plugin tobiko /vagrant
|
||||
|
||||
# Configure neutron
|
||||
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.250,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
|
40
devstack/vagrant/provision.bash
Executable file
40
devstack/vagrant/provision.bash
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
if [ -r "./provisionrc" ]; then
|
||||
echo "Load parameters from RC file"
|
||||
source "./provisionrc" || true
|
||||
fi
|
||||
|
||||
echo "Process script parameters and set default values when needed"
|
||||
export PROVISION_DIR=${PROVISION_DIR:-$(cd "$(dirname "$0")" && pwd)}
|
||||
export GIT_BASE=${OPENSTACK_GIT_BASE:-https://git.openstack.org}
|
||||
export DEVSTACK_GIT_REPO=${DEVSTACK_GIT_REPO:-${GIT_BASE}/openstack-dev/devstack}
|
||||
export DEVSTACK_GIT_BRANCH=${DEVSTACK_GIT_BRANCH:-stable/queens}
|
||||
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}
|
||||
|
||||
echo "Provisioning DevStack on host $(hostname) as user ${USER}"
|
||||
echo "Current directory is $(pwd)"
|
||||
|
||||
if ! [ -d "${DEVSTACK_SRC_DIR}" ]; then
|
||||
if ! which git; then
|
||||
echo "Install Git"
|
||||
sudo yum install -y git
|
||||
fi
|
||||
|
||||
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}/"
|
||||
|
||||
cd "${DEVSTACK_SRC_DIR}"
|
||||
echo "Run DevStack from directory: $(pwd)"
|
||||
|
||||
./stack.sh
|
Loading…
x
Reference in New Issue
Block a user