Fix vagrant development environment
After the repo split into kolla and kolla-ansible the Vagrant development environment was broken. With this change Vagrant will run from kolla-ansible and kolla repo is expected to be in the same directory level so the bootstrap can include it inside the VM. - Modified the bootstrap code to copy both repos into the VM. - Added one configuration token to specify kolla-ansible location inside the VM. - Updated the docs. Change-Id: I6b56822d50472f8eda6fc60f69196d3c9b8b6cf8 Closes-Bug: 1693847
This commit is contained in:
parent
1a21bf2a4d
commit
8fe43171ce
28
contrib/dev/vagrant/Vagrantfile
vendored
28
contrib/dev/vagrant/Vagrantfile
vendored
@ -15,6 +15,11 @@ end
|
||||
|
||||
vagrant_dir = File.expand_path(File.dirname(__FILE__))
|
||||
|
||||
# get kolla and kolla-ansibe repos path relative to current directory
|
||||
# they will be used by the bootstrap script to configure the nodes
|
||||
kolla_ansible_repo_path = File.expand_path(File.join(vagrant_dir, '..', '..', '..'))
|
||||
kolla_repo_path = File.expand_path(File.join(vagrant_dir, '..', '..', '..', '..', 'kolla'))
|
||||
|
||||
# Vagrantfile.custom contains user customization for the Vagrantfile
|
||||
# You shouldn't have to edit the Vagrantfile, ever.
|
||||
if File.exists?(File.join(vagrant_dir, 'Vagrantfile.custom'))
|
||||
@ -42,7 +47,8 @@ PROVIDER_DEFAULTS ||= {
|
||||
bridge_interface: "virbr0",
|
||||
vagrant_shared_folder: "/home/vagrant/sync",
|
||||
sync_method: "nfs",
|
||||
kolla_path: "/home/vagrant/kolla"
|
||||
kolla_path: "/home/vagrant/kolla",
|
||||
kolla_ansible_path: "/home/vagrant/kolla-ansible"
|
||||
}
|
||||
},
|
||||
virtualbox: {
|
||||
@ -51,14 +57,16 @@ PROVIDER_DEFAULTS ||= {
|
||||
bridge_interface: "wlp3s0b1",
|
||||
vagrant_shared_folder: "/home/vagrant/sync",
|
||||
sync_method: "virtualbox",
|
||||
kolla_path: "/home/vagrant/kolla"
|
||||
kolla_path: "/home/vagrant/kolla",
|
||||
kolla_ansible_path: "/home/vagrant/kolla-ansible"
|
||||
},
|
||||
ubuntu: {
|
||||
base_image: "ubuntu/wily64",
|
||||
bridge_interface: "wlp3s0b1",
|
||||
vagrant_shared_folder: "/home/vagrant/sync",
|
||||
sync_method: "virtualbox",
|
||||
kolla_path: "/home/vagrant/kolla"
|
||||
kolla_path: "/home/vagrant/kolla",
|
||||
kolla_ansible_path: "/home/vagrant/kolla-ansible"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,6 +167,13 @@ def configure_wifi_if_enabled(vm)
|
||||
end
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
|
||||
# check for kolla repo to be available
|
||||
unless File.directory?(kolla_repo_path)
|
||||
raise VagrantConfigMissing,
|
||||
"Missing kolla repository checkout at #{kolla_repo_path}"
|
||||
end
|
||||
|
||||
config.vm.box = get_default(:base_image)
|
||||
|
||||
# Next to the hostonly NAT-network there is a host-only network with all
|
||||
@ -209,8 +224,9 @@ Vagrant.configure(2) do |config|
|
||||
# The operator controls the deployment
|
||||
config.vm.define "operator", primary: true do |admin|
|
||||
admin.vm.hostname = "operator.local"
|
||||
admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{get_default(:kolla_path)}"
|
||||
admin.vm.synced_folder File.join(vagrant_dir, '..', '..', '..'), get_default(:kolla_path), create:"True", type: get_default(:sync_method)
|
||||
admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{get_default(:kolla_path)} #{get_default(:kolla_ansible_path)}"
|
||||
admin.vm.synced_folder kolla_ansible_repo_path, get_default(:kolla_ansible_path), create:"True", type: get_default(:sync_method)
|
||||
admin.vm.synced_folder kolla_repo_path, get_default(:kolla_path), create:"True", type: get_default(:sync_method)
|
||||
admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'operator'), "/data/host", create:"True", type: get_default(:sync_method)
|
||||
admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
|
||||
admin.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true
|
||||
@ -231,7 +247,7 @@ Vagrant.configure(2) do |config|
|
||||
hostname = "#{node_type}0#{i}"
|
||||
config.vm.define hostname do |node|
|
||||
node.vm.hostname = "#{hostname}.local"
|
||||
node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{get_default(:kolla_path)}"
|
||||
node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{get_default(:kolla_path)} #{get_default(:kolla_ansible_path)}"
|
||||
node.vm.synced_folder File.join(vagrant_dir, 'storage', node_type), "/data/host", create:"True", type: get_default(:sync_method)
|
||||
node.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
|
||||
node.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true
|
||||
|
@ -28,7 +28,8 @@
|
||||
# bridge_interface: "virbr0",
|
||||
# vagrant_shared_folder: "/home/vagrant/sync",
|
||||
# sync_method: "nfs",
|
||||
# kolla_path: "/home/vagrant/kolla"
|
||||
# kolla_path: "/home/vagrant/kolla",
|
||||
# kolla_ansible_path: "/home/vagrant/kolla-ansible"
|
||||
# }
|
||||
# },
|
||||
# virtualbox: {
|
||||
@ -37,14 +38,16 @@
|
||||
# bridge_interface: "wlp3s0b1",
|
||||
# vagrant_shared_folder: "/home/vagrant/sync",
|
||||
# sync_method: "virtualbox",
|
||||
# kolla_path: "/home/vagrant/kolla"
|
||||
# kolla_path: "/home/vagrant/kolla",
|
||||
# kolla_ansible_path: "/home/vagrant/kolla-ansible"
|
||||
# },
|
||||
# ubuntu: {
|
||||
# base_image: "ubuntu/wily64",
|
||||
# bridge_interface: "wlp3s0b1",
|
||||
# vagrant_shared_folder: "/home/vagrant/sync",
|
||||
# sync_method: "virtualbox",
|
||||
# kolla_path: "/home/vagrant/kolla"
|
||||
# kolla_path: "/home/vagrant/kolla",
|
||||
# kolla_ansible_path: "/home/vagrant/kolla-ansible"
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
|
@ -9,6 +9,7 @@
|
||||
VM=$1
|
||||
MODE=$2
|
||||
KOLLA_PATH=$3
|
||||
KOLLA_ANSIBLE_PATH=$4
|
||||
|
||||
export http_proxy=
|
||||
export https_proxy=
|
||||
@ -168,6 +169,7 @@ function configure_operator {
|
||||
|
||||
pip install --upgrade "ansible>=2" python-openstackclient python-neutronclient tox
|
||||
|
||||
pip install ${KOLLA_ANSIBLE_PATH}
|
||||
pip install ${KOLLA_PATH}
|
||||
|
||||
# Set selinux to permissive
|
||||
@ -177,8 +179,9 @@ function configure_operator {
|
||||
fi
|
||||
|
||||
tox -c ${KOLLA_PATH}/tox.ini -e genconfig
|
||||
cp -r ${KOLLA_PATH}/etc/kolla/ /etc/kolla
|
||||
${KOLLA_PATH}/tools/generate_passwords.py
|
||||
cp -r ${KOLLA_ANSIBLE_PATH}/etc/kolla/ /etc/kolla
|
||||
cp -r ${KOLLA_PATH}/etc/kolla/* /etc/kolla
|
||||
${KOLLA_ANSIBLE_PATH}/tools/generate_passwords.py
|
||||
mkdir -p /usr/share/kolla
|
||||
chown -R vagrant: /etc/kolla /usr/share/kolla
|
||||
|
||||
|
@ -92,14 +92,18 @@ correctly. On Fedora 22::
|
||||
sudo systemctl start libvirtd
|
||||
sudo systemctl enable libvirtd
|
||||
|
||||
Find a location in the system's home directory and checkout the Kolla repo::
|
||||
Find a location in the system's home directory and checkout Kolla repos::
|
||||
|
||||
git clone https://git.openstack.org/openstack/kolla-ansible
|
||||
git clone https://git.openstack.org/openstack/kolla
|
||||
|
||||
Both repos must share the same parent directory so the bootstrap code can
|
||||
locate them.
|
||||
|
||||
Developers can now tweak the Vagrantfile or bring up the default **all-in-one**
|
||||
CentOS 7-based environment::
|
||||
|
||||
cd kolla/contrib/dev/vagrant && vagrant up
|
||||
cd kolla-ansible/contrib/dev/vagrant && vagrant up
|
||||
|
||||
The command ``vagrant status`` provides a quick overview of the VMs composing
|
||||
the environment.
|
||||
|
Loading…
Reference in New Issue
Block a user