mirror of
https://github.com/gryf/openstack.git
synced 2025-12-17 11:30:24 +01:00
Open-source the OpenStack DB migration scripts and workshop
This commit is contained in:
4
migration-scripts/migration-workshop/ocata/ansible.cfg
Normal file
4
migration-scripts/migration-workshop/ocata/ansible.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[defaults]
|
||||
host_key_checking=False
|
||||
pipelining=True
|
||||
forks=100
|
||||
24
migration-scripts/migration-workshop/ocata/extra.yaml
Normal file
24
migration-scripts/migration-workshop/ocata/extra.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
kolla_base_distro: "centos"
|
||||
kolla_install_type: "source"
|
||||
openstack_release: "ocata"
|
||||
kolla_internal_vip_address: "192.168.33.25"
|
||||
network_interface: "eth1"
|
||||
enable_heat: "no"
|
||||
enable_horizon: "no"
|
||||
database_password: "kolla"
|
||||
keystone_admin_password: "steakfordinner"
|
||||
nova_database_password: "nova"
|
||||
nova_api_database_password: "nova"
|
||||
rabbitmq_user: "guest"
|
||||
rabbitmq_password: "guest"
|
||||
keystone_token_provider: "fernet"
|
||||
|
||||
glance_database_password: "kolla"
|
||||
glance_keystone_password: "glance"
|
||||
keystone_database_password: "kolla"
|
||||
nova_keystone_password: "nova"
|
||||
neutron_database_password: "password"
|
||||
neutron_keystone_password: "neutron"
|
||||
|
||||
placement_keystone_user: "nova"
|
||||
placement_keystone_password: "nova"
|
||||
39
migration-scripts/migration-workshop/ocata/ocata.sh
Executable file
39
migration-scripts/migration-workshop/ocata/ocata.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018, Oath Inc.
|
||||
# Licensed under the terms of the MIT license. See LICENSE file for terms.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
ROOT_DIR=/vagrant/ocata
|
||||
|
||||
yum remove -y docker-ce || :
|
||||
rm -f /etc/yum.repos.d/docker-ce.repo || :
|
||||
umount /var/lib/docker/devicemapper/ || :
|
||||
rm -rf /var/lib/docker/ || :
|
||||
yum install -y epel-release
|
||||
yum install -y python-pip python-devel libffi-devel gcc openssl-devel libselinux-python git
|
||||
pip install -U pip
|
||||
[ -e ${ROOT_DIR}/kolla-ansible ] || git clone https://github.com/openstack/kolla-ansible.git ${ROOT_DIR}/kolla-ansible -b stable/ocata
|
||||
pip install ${ROOT_DIR}/kolla-ansible
|
||||
pip install "ansible>=2,<2.4" virtualenv
|
||||
|
||||
[ -e /etc/ansible ] || mkdir /etc/ansible
|
||||
cp ${ROOT_DIR}/ansible.cfg /etc/ansible/
|
||||
[ -e /etc/kolla ] || cp -r ${ROOT_DIR}/kolla-ansible/etc/kolla /etc/
|
||||
kolla-genpwd
|
||||
mkdir -p /etc/kolla/config/nova/
|
||||
cat > /etc/kolla/config/nova/nova-compute.conf <<EOF
|
||||
[libvirt]
|
||||
virt_type = qemu
|
||||
cpu_mode = none
|
||||
EOF
|
||||
|
||||
cp ${ROOT_DIR}/kolla-ansible/ansible/inventory/all-in-one ${ROOT_DIR}
|
||||
kolla-ansible -i ${ROOT_DIR}/all-in-one --extra @${ROOT_DIR}/extra.yaml bootstrap-servers
|
||||
kolla-ansible -i ${ROOT_DIR}/all-in-one --extra @${ROOT_DIR}/extra.yaml prechecks
|
||||
kolla-ansible -i ${ROOT_DIR}/all-in-one --extra @${ROOT_DIR}/extra.yaml pull
|
||||
kolla-ansible -i ${ROOT_DIR}/all-in-one --extra @${ROOT_DIR}/extra.yaml deploy
|
||||
docker exec openvswitch_db ovs-vsctl set interface eth1 type=internal
|
||||
|
||||
kolla-ansible --extra @${ROOT_DIR}/extra.yaml post-deploy
|
||||
cp /etc/kolla/admin-openrc.sh /home/vagrant
|
||||
11
migration-scripts/migration-workshop/ocata/redeploy.sh
Executable file
11
migration-scripts/migration-workshop/ocata/redeploy.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018, Oath Inc.
|
||||
# Licensed under the terms of the MIT license. See LICENSE file for terms.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
ROOT_DIR=/vagrant/ocata
|
||||
|
||||
docker rm -f $(docker ps -aq)
|
||||
kolla-ansible -i ${ROOT_DIR}/all-in-one --extra @${ROOT_DIR}/extra.yaml bootstrap-servers
|
||||
kolla-ansible -i ${ROOT_DIR}/all-in-one --extra @${ROOT_DIR}/extra.yaml deploy
|
||||
10
migration-scripts/migration-workshop/ocata/restore_dump.sh
Executable file
10
migration-scripts/migration-workshop/ocata/restore_dump.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018, Oath Inc.
|
||||
# Licensed under the terms of the MIT license. See LICENSE file for terms.
|
||||
|
||||
mysql -h192.168.33.10 -uroot -pkolla -e "show databases" | grep -v Database | grep -v mysql| grep -v information_schema| gawk '{print "drop database " $1 ";select sleep(0.1);"}' | mysql -h192.168.33.10 -uroot -pkolla
|
||||
mysql -h192.168.33.10 -uroot -pkolla < ocata_db_dump.sql
|
||||
cp -r instances/ /var/lib/docker/volumes/nova_compute/_data
|
||||
cp -r images/ /var/lib/docker/volumes/glance/_data
|
||||
chown --reference=/var/lib/docker/volumes/nova_compute/_data -R /var/lib/docker/volumes/nova_compute/_data
|
||||
chown --reference=/var/lib/docker/volumes/glance/_data -R /var/lib/docker/volumes/glance/_data
|
||||
5
migration-scripts/migration-workshop/ocata/stop_ocata_services.sh
Executable file
5
migration-scripts/migration-workshop/ocata/stop_ocata_services.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018, Oath Inc.
|
||||
# Licensed under the terms of the MIT license. See LICENSE file for terms.
|
||||
|
||||
docker stop $(docker ps --format '{{.ID}} {{.Names}}' | grep -v maria | awk '{print $1}')
|
||||
Reference in New Issue
Block a user