Browse Source

Revert speedup merge (couldn't launch instances)

configure-hook
Pete Vander Giessen 3 years ago
parent
commit
320a522d73
  1. BIN
      snap-overlay/data/mysql.tar.xz
  2. 178
      snap/hooks/configure
  3. 16
      snap/hooks/install

BIN
snap-overlay/data/mysql.tar.xz

178
snap/hooks/configure

@ -1,5 +1,12 @@
#!/bin/bash -e
# Install conf.d configuration from snap for db etc
echo "Installing configuration for OpenStack Services"
for project in neutron nova keystone glance; do
mkdir -p ${SNAP_COMMON}/etc/${project}/${project}.conf.d
cp -r ${SNAP}/etc/${project}/${project}.conf.d/* ${SNAP_COMMON}/etc/${project}/${project}.conf.d
done
# Create all of the databases
echo "Creating OpenStack Databases"
@ -36,174 +43,3 @@ ovs-vsctl --retry --may-exist add-br br-ex
# Configure br-ex
ip address add 10.20.20.1/24 dev br-ex || :
ip link set br-ex up || :
# Keystone
echo "Configuring Keystone"
snap-openstack keystone-manage fernet_setup --keystone-user root --keystone-group root
snap-openstack keystone-manage db_sync
systemctl restart snap.microstack.keystone-*
openstack user show admin || {
snap-openstack keystone-manage bootstrap \
--bootstrap-password $OS_PASSWORD \
--bootstrap-admin-url http://localhost:5000/v3/ \
--bootstrap-internal-url http://localhost:5000/v3/ \
--bootstrap-public-url http://localhost:5000/v3/ \
--bootstrap-region-id RegionOne
}
openstack project show service || {
openstack project create --domain default --description "Service Project" service
}
# Nova
echo "Configuring Nova"
openstack user show nova || {
openstack user create --domain default --password nova nova
openstack role add --project service --user nova admin
}
openstack user show placement || {
openstack user create --domain default --password placement placement
openstack role add --project service --user placement admin
}
openstack service show compute || {
openstack service create --name nova \
--description "OpenStack Compute" compute
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
compute $endpoint http://localhost:8774/v2.1 || :
done
}
openstack service show placement || {
openstack service create --name placement \
--description "Placement API" placement
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
placement $endpoint http://localhost:8778 || :
done
}
snap-openstack nova-manage api_db sync
snap-openstack nova-manage cell_v2 list_cells | grep cell0 || {
snap-openstack nova-manage cell_v2 map_cell0
}
snap-openstack nova-manage cell_v2 list_cells | grep cell1 || {
snap-openstack nova-manage cell_v2 create_cell --name=cell1 --verbose
}
snap-openstack nova-manage db sync
systemctl restart snap.microstack.nova-*
while ! nc -z localhost 8774; do sleep 0.1; done;
sleep 5
openstack flavor show m1.tiny || {
openstack flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
}
openstack flavor show m1.small || {
openstack flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
}
openstack flavor show m1.medium || {
openstack flavor create --id 3 --ram 4096 --disk 20 --vcpus 2 m1.medium
}
openstack flavor show m1.large || {
openstack flavor create --id 4 --ram 8192 --disk 20 --vcpus 4 m1.large
}
openstack flavor show m1.xlarge || {
openstack flavor create --id 5 --ram 16384 --disk 20 --vcpus 8 m1.xlarge
}
# Neutron
echo "Configuring Neutron"
openstack user show neutron || {
openstack user create --domain default --password neutron neutron
openstack role add --project service --user neutron admin
}
openstack service show network || {
openstack service create --name neutron \
--description "OpenStack Network" network
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
network $endpoint http://localhost:9696 || :
done
}
snap-openstack neutron-db-manage upgrade head
systemctl restart snap.microstack.neutron-*
while ! nc -z localhost 9696; do sleep 0.1; done;
sleep 5
openstack network show test || {
openstack network create test
}
openstack subnet show test-subnet || {
openstack subnet create --network test --subnet-range 192.168.222.0/24 test-subnet
}
openstack network show external || {
openstack network create --external \
--provider-physical-network=physnet1 \
--provider-network-type=flat external
}
openstack subnet show external-subnet || {
openstack subnet create --network external --subnet-range 10.20.20.0/24 \
--no-dhcp external-subnet
}
openstack router show test-router || {
openstack router create test-router
openstack router add subnet test-router test-subnet
openstack router set --external-gateway external test-router
}
# Glance
echo "Configuring Glance"
openstack user show glance || {
openstack user create --domain default --password glance glance
openstack role add --project service --user glance admin
}
openstack service show image || {
openstack service create --name glance --description "OpenStack Image" image
for endpoint in internal admin public; do
openstack endpoint create --region RegionOne \
image $endpoint http://localhost:9292 || :
done
}
snap-openstack glance-manage db_sync
systemctl restart snap.microstack.glance*
while ! nc -z localhost 9292; do sleep 0.1; done;
sleep 5
openstack image show cirros || {
[ -f $HOME/images/cirros-0.3.5-x86_64-disk.img ] || {
mkdir -p $HOME/images
wget \
http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img \
-O ${HOME}/images/cirros-0.3.5-x86_64-disk.img
}
openstack image create --file ${HOME}/images/cirros-0.3.5-x86_64-disk.img \
--public --container-format=bare --disk-format=qcow2 cirros
}

16
snap/hooks/install

@ -3,19 +3,3 @@ set -e
install -D $SNAP/var/snap/microstack/common/libvirt/libvirtd.conf $SNAP_COMMON/libvirt/libvirtd.conf
sed -i 's/unix_sock_group = "libvirtd"/unix_sock_group = "sudo"/' $SNAP_COMMON/libvirt/libvirtd.conf
# MySQL snapshot for speedy install
# snapshot is a mysql data dir with
# rocky keystone,nova,glance,neutron dbs.
mkdir -p ${SNAP_COMMON}/lib
tar -xJf ${SNAP}/data/mysql.tar.xz -C ${SNAP_COMMON}/lib
# Install conf.d configuration from snap for db etc
echo "Installing configuration for OpenStack Services"
for project in neutron nova keystone glance; do
mkdir -p ${SNAP_COMMON}/etc/${project}/${project}.conf.d
cp -r ${SNAP}/etc/${project}/${project}.conf.d/* ${SNAP_COMMON}/etc/${project}/${project}.conf.d
done
# Configure Keystone Fernet Keys
snap-openstack keystone-manage fernet_setup --keystone-user root --keystone-group root
Loading…
Cancel
Save