This enables basic clustering functionality. We add: tools/cluster/cluster/daemon.py: A server that handles validation of cluster passwords. tools/cluster/cluster/client.py: A client for this server. Important Note: This prototype does not support TLS, and the functionality in the client and server is basic. Before we roll clustering out to production, we need to have those two chat over TLS, and be much more careful about verifying credentials. Also included ... Various fixes and changes to the init script and config templates to support cluster configuration, and allow for the fact that we may have endpoint references for two network ips. Updates to snapcraft.yaml, adding the new tooling. A more formalized config infrastructure. It's still a TODO to move the specification out of the implicit definition in the install hook, and into a nice, explicit, well documented yaml file. Added nesting to the Question classes in the init script, as well as strings pointing at config keys, rather than having the config be implicitly indicated by the Question subclass' name. (This allows us to put together a config spec that doesn't require the person reading the spec to understand what Questions are, and how they are implemented.) Renamed and unified the "unit" and "lint" tox environments, to allow for the multiple Python tools that we want to lint and test. Added hooks in the init script to make it possible to do automated testing, and added an automated test for a cluster. Run with "tox -e cluster". Added cirros image to snap, to work around sporadic issues downloading it from download.cirros.net. Removed ping logic from snap, to workaround failures in gate. Need to add it back in once we fix them. Change-Id: I44ccd16168a7ed41486464df8c9e22a14d71ccfd
		
			
				
	
	
		
			70 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
set -ex
 | 
						|
 | 
						|
# Initialize Config
 | 
						|
# TODO: put this in a nice yaml format, and parse it.
 | 
						|
 | 
						|
# General snap-wide settings
 | 
						|
snapctl set \
 | 
						|
        config.clustered=false \
 | 
						|
        config.post-setup=true \
 | 
						|
        ;
 | 
						|
 | 
						|
# Networking related settings.
 | 
						|
snapctl set \
 | 
						|
        config.network.dns=1.1.1.1 \
 | 
						|
        config.network.ext-gateway=10.20.20.1 \
 | 
						|
        config.network.control-ip=10.20.20.1 \
 | 
						|
        config.network.compute-ip=10.20.20.1 \
 | 
						|
        config.network.ext-cidr=10.20.20.1/24 \
 | 
						|
        config.network.security-rules=true \
 | 
						|
        ;
 | 
						|
 | 
						|
# Passwords, certs, etc.
 | 
						|
snapctl set \
 | 
						|
        config.credentials.os-password=keystone \
 | 
						|
        config.credentials.key-pair=id_microstack \
 | 
						|
        config.credentials.nova-password=nova \
 | 
						|
        config.credentials.neutron-password=neutron \
 | 
						|
        config.credentials.placement-password=placement \
 | 
						|
        config.credentials.glance-password=glance \
 | 
						|
        ;
 | 
						|
 | 
						|
# Host optimizations and fixes.
 | 
						|
snapctl set \
 | 
						|
        config.host.ip-forwarding=true \
 | 
						|
        config.host.check-qemu=true \
 | 
						|
        ;
 | 
						|
 | 
						|
# Enable or disable groups of services.
 | 
						|
snapctl set \
 | 
						|
        config.services.control-plane=true \
 | 
						|
        config.services.hypervisor=true \
 | 
						|
        ;
 | 
						|
 | 
						|
# Clustering roles
 | 
						|
snapctl set \
 | 
						|
        cluster.role=control \
 | 
						|
        cluster.password=null \
 | 
						|
        ;
 | 
						|
 | 
						|
# MySQL snapshot for speedy install
 | 
						|
# snapshot is a mysql data dir with
 | 
						|
# rocky keystone,nova,glance,neutron dbs.
 | 
						|
mkdir -p ${SNAP_COMMON}/lib
 | 
						|
 | 
						|
# Put cirros (and potentially other) images in a user writeable place.
 | 
						|
mkdir -p ${SNAP_COMMON}/images
 | 
						|
cp ${SNAP}/images/* ${SNAP_COMMON}/images/
 | 
						|
 | 
						|
# 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 || true # Skip conf files that have been moved into templates
 | 
						|
done
 | 
						|
# Make a place for our horizon config overrides to live
 | 
						|
mkdir -p ${SNAP_COMMON}/etc/horizon/local_settings.d
 | 
						|
 | 
						|
snap-openstack setup  # Sets up templates for the first time.
 |