diff options
-rw-r--r-- | docker/README-containers.md | 7 | ||||
-rw-r--r-- | docker/compute-post.yaml | 113 | ||||
-rw-r--r-- | docker/generate_json_config.sh | 96 | ||||
-rw-r--r-- | environments/docker-network-isolation.yaml | 4 | ||||
-rw-r--r-- | environments/docker-network.yaml | 2 | ||||
-rw-r--r-- | environments/docker.yaml (renamed from environments/docker-rdo.yaml) | 1 | ||||
-rwxr-xr-x | extraconfig/tasks/yum_update.sh | 12 |
7 files changed, 124 insertions, 111 deletions
diff --git a/docker/README-containers.md b/docker/README-containers.md index 17990b54..ff062a93 100644 --- a/docker/README-containers.md +++ b/docker/README-containers.md @@ -22,7 +22,12 @@ https://github.com/openstack/tripleo-common/blob/master/scripts/tripleo.sh Create the Overcloud: ``` -$ openstack overcloud deploy --templates=tripleo-heat-templates -e tripleo-heat-templates/environments/docker-rdo.yaml --libvirt-type=qemu +$ openstack overcloud deploy --templates=tripleo-heat-templates -e tripleo-heat-templates/environments/docker.yaml -e tripleo-heat-templates/environments/docker-network.yaml --libvirt-type=qemu +``` + +Using Network Isolation in the Overcloud: +``` +$ openstack overcloud deploy --templates=tripleo-heat-templates -e tripleo-heat-templates/environments/docker.yaml -e tripleo-heat-templates/environments/docker-network-isolation.yaml --libvirt-type=qemu ``` Source the overcloudrc and then you can use the overcloud. diff --git a/docker/compute-post.yaml b/docker/compute-post.yaml index a6607fd9..8f786f72 100644 --- a/docker/compute-post.yaml +++ b/docker/compute-post.yaml @@ -1,5 +1,4 @@ -heat_template_version: 2015-04-30 - +heat_template_version: 2015-10-15 description: > OpenStack compute node post deployment for Docker. @@ -26,6 +25,26 @@ parameters: type: string DockerOpenvswitchDBImage: type: string + LibvirtConfig: + type: string + default: "/etc/libvirt/libvirtd.conf" + NovaConfig: + type: string + default: "/etc/nova/nova.conf" + NeutronOpenvswitchAgentConfig: + type: string + default: "/etc/neutron/neutron.conf,/etc/neutron/plugins/ml2/ml2_conf.ini" + NeutronAgentConfig: + type: string + default: "/etc/neutron/neutron.conf,/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" + NeutronAgentPluginVolume: + type: string + description: The neutron agent plugin to mount into the neutron-agents container + default: "/var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/ovs_neutron_plugin.ini:ro" + NeutronAgentOvsVolume: + type: string + description: The neutron agent ovs agents to mount into the neutron-agents container + default: " " resources: @@ -74,9 +93,70 @@ resources: type: OS::Heat::SoftwareConfig properties: group: script - outputs: - - name: result - config: {get_file: ./generate_json_config.sh} + inputs: + - name: libvirt_config + - name: nova_config + - name: neutron_openvswitch_agent_config + - name: neutron_agent_config + config: | + #!/bin/python + import json + import os + + data = {} + file_perms = '600' + libvirt_perms = '644' + + libvirt_config = os.getenv('libvirt_config').split(',') + nova_config = os.getenv('nova_config').split(',') + neutron_openvswitch_agent_config = os.getenv('neutron_openvswitch_agent_config').split(',') + neutron_agent_config = os.getenv('neutron_agent_config').split(',') + + # Command, Config_files, Owner, Perms + services = {'nova-libvirt': ['/usr/sbin/libvirtd', libvirt_config, 'root', libvirt_perms], + 'nova-compute': ['/usr/bin/nova-compute', nova_config, 'nova', file_perms], + 'neutron-openvswitch-agent': ['/usr/bin/neutron-openvswitch-agent', neutron_openvswitch_agent_config, 'neutron', file_perms], + 'neutron-agent': ['/usr/bin/neutron-openvswitch-agent', neutron_agent_config, 'neutron', file_perms], + 'ovs-vswitchd': ['/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/openvswitch/ovs-vswitchd.log'], + 'ovsdb-server': ['/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --log-file=/var/log/openvswitch/ovsdb-server.log'] + } + + + def build_config_files(config, owner, perms): + config_source = '/var/lib/kolla/config_files/' + config_files_dict = {} + source = os.path.basename(config) + dest = config + config_files_dict.update({'source': config_source + source, + 'dest': dest, + 'owner': owner, + 'perm': perms}) + return config_files_dict + + + for service in services: + if service != 'ovs-vswitchd' and service != 'ovsdb-server': + command = services.get(service)[0] + config_files = services.get(service)[1] + owner = services.get(service)[2] + perms = services.get(service)[3] + config_files_list = [] + for config_file in config_files: + if service == 'nova-libvirt': + command = command + ' --config ' + config_file + else: + command = command + ' --config-file ' + config_file + data['command'] = command + config_files_dict = build_config_files(config_file, owner, perms) + config_files_list.append(config_files_dict) + data['config_files'] = config_files_list + else: + data['command'] = services.get(service)[0] + data['config_files'] = [] + + json_config_dir = '/var/lib/etc-data/json-config/' + with open(json_config_dir + service + '.json', 'w') as json_file: + json.dump(data, json_file, sort_keys=True, indent=4, separators=(',', ': ')) CopyJsonDeployment: type: OS::Heat::SoftwareDeployments @@ -84,6 +164,11 @@ resources: properties: config: {get_resource: CopyJsonConfig} servers: {get_param: servers} + input_values: + libvirt_config: {get_param: LibvirtConfig} + nova_config: {get_param: NovaConfig} + neutron_openvswitch_agent_config: {get_param: NeutronOpenvswitchAgentConfig} + neutron_agent_config: {get_param: NeutronAgentConfig} NovaComputeContainersDeploymentOVS: type: OS::Heat::StructuredDeployments @@ -118,12 +203,12 @@ resources: list_join: - '/' - [ {get_param: DockerNamespace}, {get_param: DockerOpenvswitchDBImage} ] - container_name: ovs-db-server + container_name: ovsdb-server net: host restart: always volumes: - /run:/run - - /var/lib/etc-data/json-config/ovs-dbserver.json:/var/lib/kolla/config_files/config.json + - /var/lib/etc-data/json-config/ovsdb-server.json:/var/lib/kolla/config_files/config.json environment: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS @@ -234,11 +319,15 @@ resources: privileged: true restart: always volumes: - - /run:/run - - /lib/modules:/lib/modules:ro - - /var/lib/etc-data/json-config/neutron-agent.json:/var/lib/kolla/config_files/config.json - - /var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/ovs_neutron_plugin.ini:ro - - /var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro + str_split: + - "," + - list_join: + - "," + - [ "/run:/run", "/lib/modules:/lib/modules:ro", + "/var/lib/etc-data/json-config/neutron-agent.json:/var/lib/kolla/config_files/config.json", + "/var/lib/etc-data/neutron/neutron.conf:/var/lib/kolla/config_files/neutron.conf:ro", + {get_param: NeutronAgentPluginVolume}, + {get_param: NeutronAgentOvsVolume} ] environment: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS volumes_from: diff --git a/docker/generate_json_config.sh b/docker/generate_json_config.sh deleted file mode 100644 index 5cf49226..00000000 --- a/docker/generate_json_config.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -KOLLA_DEST=/var/lib/kolla/config_files -JSON_DEST=/var/lib/etc-data/json-config - -# For more config file generation, simply define a new SERVICE_DATA_ -# prefixed variable. The command string is quoted to include config-file -# arguments. Note that the variable name following SERVICE_DATA_ will be -# the filename the JSON config is written to. - -# [EXAMPLE]: SERVICE_DATA_<SERVICE_NAME>=(<command> <source> <dest> <owner> <perms>) - -SERVICE_DATA_NOVA_LIBVIRT=("/usr/sbin/libvirtd" libvirtd.conf /etc/libvirt/libvirtd.conf root 0644) -SERVICE_DATA_NOVA_COMPUTE=("/usr/bin/nova-compute" nova.conf /etc/nova/nova.conf nova 0600) -SERVICE_DATA_NEUTRON_OPENVSWITCH_AGENT=("/usr/bin/neutron-openvswitch-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini" neutron.conf /etc/neutron/neutron.conf neutron 0600 ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini neutron 0600) -SERVICE_DATA_NEUTRON_AGENT=("/usr/bin/neutron-openvswitch-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" neutron.conf /etc/neutron/neutron.conf neutron 0600 ovs_neutron_plugin.ini /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini neutron 0600) -SERVICE_DATA_OVS_VSWITCHD=("/usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --log-file=/var/log/openvswitch/ovs-vswitchd.log") -SERVICE_DATA_OVS_DBSERVER=("/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/run/openvswitch/db.sock --log-file=/var/log/openvswitch/ovsdb-server.log") - -function create_json_header() { - local command=$1 - - echo "\ -{ - \"command\": \"${command[@]}\"," - -} - -function create_config_file_header() { - echo " \"config_files\": [" -} - -function create_config_file_block() { - local source=$KOLLA_DEST/$1 - local dest=$2 - local owner=$3 - local perm=$4 - - printf "\ -\t{ -\t \"source\": \"$source\", -\t \"dest\": \"$dest\", -\t \"owner\": \"$owner\", -\t \"perm\": \"$perm\" -\t}" -} - -function add_trailing_comma() { - printf ", \n" -} - -function create_config_file_trailer() { - echo -e "\n ]" -} - -function create_json_trailer() { - echo "}" -} - -function create_json_data() { - local config_data=$1 - shift - - create_json_header "$config_data" - create_config_file_header - while [ "$1" ]; do - create_config_file_block "$@" - shift 4 - if [ "$1" ]; then - add_trailing_comma - fi - done - create_config_file_trailer - create_json_trailer -} - -function write_json_data() { - - local name=$1[@] - local service_data=("${!name}") - - local service_name=${1#SERVICE_DATA_} # chop SERVICE_DATA_ prefix - service_name=${service_name//_/-} # switch underscore to dash - service_name=${service_name,,} # change to lowercase - - echo "Creating JSON file ${service_name}" - create_json_data "${service_data[@]}" > "$JSON_DEST/$service_name.json" -} - -function process_configs() { - for service in ${!SERVICE_DATA_*}; do - write_json_data "${service}" - done -} - -process_configs diff --git a/environments/docker-network-isolation.yaml b/environments/docker-network-isolation.yaml new file mode 100644 index 00000000..257d03dc --- /dev/null +++ b/environments/docker-network-isolation.yaml @@ -0,0 +1,4 @@ +parameter_defaults: + NeutronAgentConfig: "/etc/neutron/neutron.conf,/etc/neutron/plugins/openvswitch/openvswitch_agent.ini" + NeutronAgentPluginVolume: "/var/lib/etc-data/neutron/plugins/ml2/openvswitch_agent.ini:/var/lib/kolla/config_files/openvswitch_agent.ini:ro" + NeutronAgentOvsVolume: "/var/lib/etc-data/neutron/conf.d/neutron-openvswitch-agent:/etc/neutron/conf.d/neutron-openvswitch-agent:ro" diff --git a/environments/docker-network.yaml b/environments/docker-network.yaml new file mode 100644 index 00000000..f10ec389 --- /dev/null +++ b/environments/docker-network.yaml @@ -0,0 +1,2 @@ +resource_registry: + OS::TripleO::Compute::Net::SoftwareConfig: ../net-config-bridge.yaml diff --git a/environments/docker-rdo.yaml b/environments/docker.yaml index 66824feb..6376b749 100644 --- a/environments/docker-rdo.yaml +++ b/environments/docker.yaml @@ -2,7 +2,6 @@ resource_registry: # Docker container with heat agents for containerized compute node. OS::TripleO::ComputePostDeployment: ../docker/compute-post.yaml OS::TripleO::NodeUserData: ../docker/firstboot/install_docker_agents.yaml - OS::TripleO::Compute::Net::SoftwareConfig: ../net-config-bridge.yaml parameters: NovaImage: atomic-image diff --git a/extraconfig/tasks/yum_update.sh b/extraconfig/tasks/yum_update.sh index e32369e1..2d6b8cc2 100755 --- a/extraconfig/tasks/yum_update.sh +++ b/extraconfig/tasks/yum_update.sh @@ -24,6 +24,7 @@ update_identifier=${update_identifier//[^a-zA-Z0-9-_]/} # seconds to wait for this node to rejoin the cluster after update cluster_start_timeout=600 galera_sync_timeout=360 +cluster_settle_timeout=1800 timestamp_file="$timestamp_dir/$update_identifier" if [[ -a "$timestamp_file" ]]; then @@ -128,7 +129,10 @@ openstack-nova-scheduler" pcs -f $pacemaker_dumpfile resource update mongod op stop timeout=100s echo "Applying new Pacemaker config" - pcs cluster cib-push $pacemaker_dumpfile + if ! pcs cluster cib-push $pacemaker_dumpfile; then + echo "ERROR failed to apply new pacemaker config" + exit 1 + fi echo "Pacemaker running, stopping cluster node and doing full package update" node_count=$(pcs status xml | grep -o "<nodes_configured.*/>" | grep -o 'number="[0-9]*"' | grep -o "[0-9]*") @@ -188,6 +192,12 @@ if [[ "$pacemaker_status" == "active" ]] ; then fi done + echo "Waiting for pacemaker cluster to settle" + if ! timeout -k 10 $cluster_settle_timeout crm_resource --wait; then + echo "ERROR timed out while waiting for the cluster to settle" + exit 1 + fi + pcs status else |