diff options
Diffstat (limited to 'extraconfig')
14 files changed, 664 insertions, 12 deletions
diff --git a/extraconfig/all_nodes/contrail/enable_contrail_repo.yaml b/extraconfig/all_nodes/contrail/enable_contrail_repo.yaml new file mode 100644 index 00000000..51da6f65 --- /dev/null +++ b/extraconfig/all_nodes/contrail/enable_contrail_repo.yaml @@ -0,0 +1,43 @@ +heat_template_version: pike + +parameters: + ContrailRepo: + type: string + default: '' + +resources: + userdata: + type: OS::Heat::MultipartMime + properties: + parts: + - config: {get_resource: EnableContrailRepoConfig} + + EnableContrailRepoConfig: + type: OS::Heat::SoftwareConfig + properties: + config: + str_replace: + template: | + #!/bin/bash + contrail_repo=$contrail_repo + if [[ ${contrail_repo} ]]; then + cat <<EOF > /etc/yum.repos.d/contrail.repo + [Contrail] + name=Contrail Repo + baseurl=${contrail_repo} + enabled=1 + gpgcheck=0 + protect=1 + metadata_expire=30 + EOF + fi + params: + $contrail_repo: {get_param: ContrailRepo} + +outputs: + # This means get_resource from the parent template will get the userdata, see: + # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent + # Note this is new-for-kilo, an alternative is returning a value then using + # get_attr in the parent template instead. + OS::stack_id: + value: {get_resource: userdata} diff --git a/extraconfig/post_deploy/example_run_on_update.yaml b/extraconfig/post_deploy/example_run_on_update.yaml index 346a1d77..4e378b14 100644 --- a/extraconfig/post_deploy/example_run_on_update.yaml +++ b/extraconfig/post_deploy/example_run_on_update.yaml @@ -14,6 +14,9 @@ parameters: # otherwise unchanged DeployIdentifier: type: string + default: '' + description: > + Setting this to a unique value will re-run any deployment tasks which perform configuration on a Heat stack-update. resources: diff --git a/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml b/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml index 96632bc2..fb0d1699 100644 --- a/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml +++ b/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml @@ -59,6 +59,19 @@ parameters: description: | When enabled, the system will perform a yum update after performing the RHEL Registration process. + deployment_actions: + default: ['CREATE', 'UPDATE'] + type: comma_delimited_list + description: > + List of stack actions that will trigger any deployments in this + templates. The actions will be an empty list of the server is in the + toplevel DeploymentServerBlacklist parameter's value. + +conditions: + deployment_actions_empty: + equals: + - {get_param: deployment_actions} + - [] resources: @@ -136,7 +149,11 @@ resources: name: RHELUnregistrationDeployment server: {get_param: server} config: {get_resource: RHELUnregistration} - actions: ['DELETE'] # Only do this on DELETE + actions: + if: + - deployment_actions_empty + - [] + - ['DELETE'] # Only do this on DELETE input_values: REG_METHOD: {get_param: rhel_reg_method} @@ -169,7 +186,11 @@ resources: name: UpdateDeploymentAfterRHELRegistration config: {get_resource: YumUpdateConfigurationAfterRHELRegistration} server: {get_param: server} - actions: ['CREATE'] # Only do this on CREATE + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE outputs: deploy_stdout: diff --git a/extraconfig/pre_network/ansible_host_config.yaml b/extraconfig/pre_network/ansible_host_config.yaml index f4f1a14a..2d862613 100644 --- a/extraconfig/pre_network/ansible_host_config.yaml +++ b/extraconfig/pre_network/ansible_host_config.yaml @@ -31,7 +31,7 @@ line: 'isolated_cores={{ _TUNED_CORES_ }}' when: _TUNED_CORES_|default("") != "" - - name: Tune-d provile activation + - name: Tune-d profile activation shell: tuned-adm profile {{ _TUNED_PROFILE_NAME_ }} become: true when: _TUNED_PROFILE_NAME_|default("") != "" diff --git a/extraconfig/pre_network/config_then_reboot.yaml b/extraconfig/pre_network/config_then_reboot.yaml index 48ba5263..79cb7cbc 100644 --- a/extraconfig/pre_network/config_then_reboot.yaml +++ b/extraconfig/pre_network/config_then_reboot.yaml @@ -7,6 +7,19 @@ description: > parameters: server: type: string + deployment_actions: + default: ['CREATE', 'UPDATE'] + type: comma_delimited_list + description: > + List of stack actions that will trigger any deployments in this + templates. The actions will be an empty list of the server is in the + toplevel DeploymentServerBlacklist parameter's value. + +conditions: + deployment_actions_empty: + equals: + - {get_param: deployment_actions} + - [] resources: @@ -24,6 +37,11 @@ resources: name: SomeDeployment server: {get_param: server} config: {get_resource: SomeConfig} + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE actions: ['CREATE'] # Only do this on CREATE RebootConfig: @@ -44,5 +62,9 @@ resources: name: RebootDeployment server: {get_param: server} config: {get_resource: RebootConfig} - actions: ['CREATE'] # Only do this on CREATE + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE signal_transport: NO_SIGNAL diff --git a/extraconfig/pre_network/contrail/compute_pre_network.yaml b/extraconfig/pre_network/contrail/compute_pre_network.yaml new file mode 100644 index 00000000..a30330f9 --- /dev/null +++ b/extraconfig/pre_network/contrail/compute_pre_network.yaml @@ -0,0 +1,162 @@ +heat_template_version: pike + +# NOTE: You don't need to pass the parameter explicitly from the +# parent template, it can be specified via the parameter_defaults +# in the resource_registry instead, if you want to override the default +# and/or share values with other templates in the tree. +parameters: + ContrailRepo: + type: string + default: '' + ContrailVrouterPhysicalInterface: + default: 'eth0' + description: vRouter physical interface + type: string + ContrailVlanParentInterface: + default: '' + description: Parent interface of vlan interface + type: string + ContrailBondInterface: + default: '' + description: Bond interface name + type: string + ContrailBondInterfaceMembers: + default: '' + description: Bond interface members + type: string + ContrailBondMode: + default: '4' + description: Bond Mode + type: string + ContrailBondPolicy: + default: '1' + description: Bond Policy + type: string + RoleParameters: + type: json + description: Role Specific parameters + default: {} + ServiceNames: + type: comma_delimited_list + default: [] + server: + type: string + +description: > + This template installs the Contrail kernel module packages in order + to bring vhost0 interface up. Vhost0 interface must be up before + os-net-config takes over. + +resources: + + ContrailVrouterModuleDeployment: + type: OS::Heat::SoftwareDeployment + properties: + name: ContrailVrouterModuleDeployment + server: {get_param: server} + config: {get_resource: ContrailVrouterModuleConfig} + input_values: + phy_int: {get_param: ContrailVrouterPhysicalInterface} + bond_int: {get_param: ContrailBondInterface} + bond_int_members: {get_param: ContrailBondInterfaceMembers} + vlan_parent: {get_param: ContrailVlanParentInterface} + contrail_repo: {get_param: ContrailRepo} + bond_mode: {get_param: ContrailBondMode} + bond_policy: {get_param: ContrailBondPolicy} + actions: ['CREATE'] # Only do this on CREATE + + ContrailVrouterModuleConfig: + type: OS::Heat::SoftwareConfig + properties: + group: script + inputs: + - name: phy_int + - name: bond_int + - name: bond_int_members + - name: vlan_parent + - name: contrail_repo + - name: bond_mode + - name: bond_policy + config: | + #!/bin/bash + phy_int=$phy_int + bond_int=$bond_int + bond_int_members=$bond_int_members + bond_mode=$bond_mode + bond_policy=$bond_policy + vlan_parent=$vlan_parent + contrail_repo=$contrail_repo + if [[ ${contrail_repo} ]]; then + yum install -y contrail-vrouter-utils + fi + function pkt_setup () { + for f in /sys/class/net/$1/queues/rx-* + do + q="$(echo $f | cut -d '-' -f2)" + r=$(($q%32)) + s=$(($q/32)) + ((mask=1<<$r)) + str=(`printf "%x" $mask`) + if [ $s -gt 0 ]; then + for ((i=0; i < $s; i++)) + do + str+=,00000000 + done + fi + echo $str > $f/rps_cpus + done + ifconfig $1 up + } + function insert_vrouter() { + if [ -f /sys/class/net/pkt1/queues/rx-0/rps_cpus ]; then + pkt_setup pkt1 + fi + if [ -f /sys/class/net/pkt2/queues/rx-0/rps_cpus ]; then + pkt_setup pkt2 + fi + if [ -f /sys/class/net/pkt3/queues/rx-0/rps_cpus ]; then + pkt_setup pkt3 + fi + DEV_MAC=$(cat /sys/class/net/${phy_int}/address) + vif --create vhost0 --mac $DEV_MAC + vif --add ${phy_int} --mac $DEV_MAC --vrf 0 --vhost-phys --type physical + vif --add vhost0 --mac $DEV_MAC --vrf 0 --type vhost --xconnect ${phy_int} + ip link set vhost0 up + return 0 + } + if [[ ${bond_int} ]]; then + bond_int_member_list=$(echo ${bond_int_members} | tr "," "\n") + ip link add name ${bond_int} type bond + echo ${bond_mode} > /sys/class/net/${bond_int}/bonding/mode + echo ${bond_policy} > /sys/class/net/${bond_int}/bonding/xmit_hash_policy + for member in ${bond_int_member_list}; do + ip link set dev $member master ${bond_int} + done + fi + if [[ ${vlan_parent} ]]; then + vlanId=`echo ${phy_int} | awk -F"vlan" '{print $2}'` + ip link add name ${phy_int} link ${vlan_parent} type vlan id ${vlanId} + fi + if [[ ${contrail_repo} ]]; then + yumdownloader contrail-vrouter --destdir /tmp + cd /tmp + rpm2cpio /tmp/contrail-vrouter*.rpm | cpio -idmv + cp `find /tmp/lib/modules -name vrouter.ko |tail -1` /tmp + insmod /tmp/vrouter.ko + else + modprobe vrouter + fi + insert_vrouter + if [[ `ifconfig ${phy_int} |grep "inet "` ]]; then + def_gw='' + if [[ `ip route show |grep default|grep ${phy_int}` ]]; then + def_gw=`ip route show |grep default|grep ${phy_int}|awk '{print $3}'` + fi + ip=`ifconfig ${phy_int} |grep "inet "|awk '{print $2}'` + mask=`ifconfig ${phy_int} |grep "inet "|awk '{print $4}'` + ip address delete $ip/$mask dev ${phy_int} + ip address add $ip/$mask dev vhost0 + if [[ $def_gw ]]; then + ip route add default via $def_gw + fi + fi diff --git a/extraconfig/pre_network/contrail/contrail_dpdk_pre_network.yaml b/extraconfig/pre_network/contrail/contrail_dpdk_pre_network.yaml new file mode 100644 index 00000000..623eb7e0 --- /dev/null +++ b/extraconfig/pre_network/contrail/contrail_dpdk_pre_network.yaml @@ -0,0 +1,168 @@ +heat_template_version: pike + +# NOTE: You don't need to pass the parameter explicitly from the +# parent template, it can be specified via the parameter_defaults +# in the resource_registry instead, if you want to override the default +# and/or share values with other templates in the tree. +parameters: + ContrailRepo: + type: string + default: '' + ContrailVrouterPhysicalInterface: + default: 'eth0' + description: vRouter physical interface + type: string + ContrailVlanParentInterface: + default: '' + description: Parent interface of vlan interface + type: string + ContrailBondInterface: + default: '' + description: Bond interface name + type: string + ContrailBondInterfaceMembers: + default: '' + description: Bond interface members + type: string + ContrailBondMode: + default: '4' + description: Bond Mode + type: string + ContrailBondPolicy: + default: '1' + description: Bond Policy + type: string + ContrailDpdkHugePages: + default: '2048' + description: DPDK Hugepages setting + type: string + RoleParameters: + type: json + description: Role Specific parameters + default: {} + ServiceNames: + type: comma_delimited_list + default: [] + server: + type: string + +description: > + This template installs the Contrail dpdk packages in order + to bring vhost0 interface up. Vhost0 interface must be up before + os-net-config takes over. + +resources: + + ContrailVrouterDpdkDeployment: + type: OS::Heat::SoftwareDeployment + properties: + name: ContrailVrouterDpdkDeployment + server: {get_param: server} + config: {get_resource: ContrailVrouterDpdkConfig} + input_values: + phy_int: {get_param: ContrailVrouterPhysicalInterface} + bond_int: {get_param: ContrailBondInterface} + bond_int_members: {get_param: ContrailBondInterfaceMembers} + vlan_parent: {get_param: ContrailVlanParentInterface} + contrail_repo: {get_param: ContrailRepo} + bond_mode: {get_param: ContrailBondMode} + bond_policy: {get_param: ContrailBondPolicy} + dpdk_hugepages: {get_param: ContrailDpdkHugePages} + actions: ['CREATE'] # Only do this on CREATE + + ContrailVrouterDpdkConfig: + type: OS::Heat::SoftwareConfig + properties: + group: script + config: | + #!/bin/bash + phy_int=$phy_int + bond_int=$bond_int + bond_int_members=$bond_int_members + bond_mode=$bond_mode + bond_policy=$bond_policy + vlan_parent=$vlan_parent + contrail_repo=$contrail_repo + dpdk_hugepages=$dpdk_hugepages + echo "vm.nr_hugepages = $dpdk_hugepages" >> /etc/sysctl.conf + echo "vm.max_map_count = 128960" >> /etc/sysctl.conf + echo "kernel.core_pattern = /var/crashes/core.%e.%p.%h.%t" >> /etc/sysctl.conf + echo "net.ipv4.tcp_keepalive_time = 5" >> /etc/sysctl.conf + echo "net.ipv4.tcp_keepalive_probes = 5" >> /etc/sysctl.conf + echo "net.ipv4.tcp_keepalive_intvl = 1" >> /etc/sysctl.conf + /sbin/sysctl --system + modprobe uio + if [[ ${contrail_repo} ]]; then + yum install -y contrail-vrouter-utils contrail-vrouter-dpdk contrail-vrouter-dpdk-init + fi + pci_address=`ethtool -i ${phy_int} |grep bus-info| awk '{print $2}' |tr -d ' '` + if [[ ${vlan_parent} ]]; then + pci_address=`ethtool -i ${vlan_parent} |grep bus-info| awk '{print $2}' |tr -d ' '` + fi + if [[ ${bond_int} ]]; then + bond_int_member_list=$(echo ${bond_int_members} | tr "," "\n") + cat <<EOF> /etc/sysconfig/network-scripts/ifcfg-${bond_int} + DEVICE=${bond_int} + BOOTPROTO=none + ONBOOT=yes + USERCTL=no + BONDING_OPTS="mode=${bond_mode} xmit_hash_policy=${bond_policy}" + EOF + for member in ${bond_int_member_list}; do + cat <<EOF> /etc/sysconfig/network-scripts/ifcfg-${member} + DEVICE=${member} + BOOTPROTO=none + ONBOOT=yes + MASTER=${bond_int} + SLAVE=yes + USERCTL=no + EOF + ip link set dev ${member} down + done + ifup ${bond_int} + pci_address=0000:00:00.0 + fi + if [[ ${vlan_parent} ]]; then + echo ${vlan_parent} >> /tmp/vlan_parent + vlanId=`echo ${phy_int} | awk -F"vlan" '{print $2}'` + ip link add name ${phy_int} link ${vlan_parent} type vlan id ${vlanId} + fi + cat <<EOF > /etc/contrail/agent_param + LOG=/var/log/contrail.log + CONFIG=/etc/contrail/contrail-vrouter-agent.conf + prog=/usr/bin/contrail-vrouter-agent + pname=contrail-vrouter-agent + LIBDIR=/usr/lib64 + DEVICE=vhost0 + dev=${phy_int} + vgw_subnet_ip=__VGW_SUBNET_IP__ + vgw_intf=__VGW_INTF_LIST__ + LOGFILE=--log-file=/var/log/contrail/vrouter.log + EOF + mac=`ip link sh dev ${phy_int} | grep link/ether|awk '{print $2}' | tr -d ' '` + cat <<EOF > /etc/contrail/contrail-vrouter-agent.conf + [DEFAULT] + platform=dpdk + physical_interface_address=$pci_address + physical_interface_mac=$mac + physical_uio_driver=uio_pci_generic + [VIRTUAL-HOST-INTERFACE] + physical_interface=${phy_int} + name=vhost0 + EOF + echo $pci_address > /etc/contrail/dpdk_pci + echo $mac > /etc/contrail/dpdk_mac + systemctl start supervisor-vrouter + if [[ `ifconfig ${phy_int} |grep "inet "` ]]; then + def_gw='' + if [[ `ip route show |grep default|grep ${phy_int}` ]]; then + def_gw=`ip route show |grep default|grep ${phy_int}|awk '{print $3}'` + fi + ip=`ifconfig ${phy_int} |grep "inet "|awk '{print $2}'` + mask=`ifconfig ${phy_int} |grep "inet "|awk '{print $4}'` + ip address delete $ip/$mask dev ${phy_int} + ip address add $ip/$mask dev vhost0 + if [[ $def_gw ]]; then + ip route add default via $def_gw + fi + fi diff --git a/extraconfig/pre_network/host_config_and_reboot.role.j2.yaml b/extraconfig/pre_network/host_config_and_reboot.role.j2.yaml index 41d8f4f6..fe52ef7e 100644 --- a/extraconfig/pre_network/host_config_and_reboot.role.j2.yaml +++ b/extraconfig/pre_network/host_config_and_reboot.role.j2.yaml @@ -19,6 +19,13 @@ parameters: {{role}}HostCpusList: type: string default: "" + deployment_actions: + default: ['CREATE', 'UPDATE'] + type: comma_delimited_list + description: > + List of stack actions that will trigger any deployments in this + templates. The actions will be an empty list of the server is in the + toplevel DeploymentServerBlacklist parameter's value. parameter_group: - label: deprecated @@ -38,6 +45,10 @@ conditions: equals: - get_param: {{role}}TunedProfileName - "" + deployment_actions_empty: + equals: + - {get_param: deployment_actions} + - [] resources: @@ -62,7 +73,11 @@ resources: name: HostParametersDeployment server: {get_param: server} config: {get_resource: HostParametersConfig} - actions: ['CREATE'] # Only do this on CREATE + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE input_values: _KERNEL_ARGS_: {get_param: {{role}}KernelArgs} _TUNED_PROFILE_NAME_: {get_param: {{role}}TunedProfileName} @@ -88,7 +103,11 @@ resources: name: RebootDeployment server: {get_param: server} config: {get_resource: RebootConfig} - actions: ['CREATE'] # Only do this on CREATE + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE signal_transport: NO_SIGNAL outputs: diff --git a/extraconfig/pre_network/host_config_and_reboot.yaml b/extraconfig/pre_network/host_config_and_reboot.yaml index 74e716ad..2f5fcdf7 100644 --- a/extraconfig/pre_network/host_config_and_reboot.yaml +++ b/extraconfig/pre_network/host_config_and_reboot.yaml @@ -11,11 +11,123 @@ parameters: type: json description: Role Specific parameters default: {} + ServiceNames: + type: comma_delimited_list + default: [] + OvsEnableDpdk: + default: false + description: Whether or not to configure enable DPDK in OVS + type: boolean + OvsDpdkCoreList: + description: > + List of cores to be used for DPDK lcore threads. Note, these threads + are used by the OVS control path for validator and handling functions. + type: string + constraints: + - allowed_pattern: "[0-9,-]*" + default: "" + OvsDpdkMemoryChannels: + description: Number of memory channels per socket to be used for DPDK + type: string + constraints: + - allowed_pattern: "[0-9]*" + default: "" + OvsDpdkSocketMemory: + default: "" + description: > + Sets the amount of hugepage memory to assign per NUMA node. It is + recommended to use the socket closest to the PCIe slot used for the + desired DPDK NIC. The format should be in "<socket 0 mem>, <socket 1 + mem>, <socket n mem>", where the value is specified in MB. For example: + "1024,0". + type: string + OvsPmdCoreList: + description: > + A list or range of CPU cores for PMD threads to be pinned to. Note, NIC + location to cores on socket, number of hyper-threaded logical cores, and + desired number of PMD threads can all play a role in configuring this + setting. These cores should be on the same socket where + OvsDpdkSocketMemory is assigned. If using hyperthreading then specify + both logical cores that would equal the physical core. Also, specifying + more than one core will trigger multiple PMD threads to be spawned which + may improve dataplane performance. + constraints: + - allowed_pattern: "[0-9,-]*" + type: string + default: "" + # DEPRECATED: the following options are deprecated and are currently maintained + # for backwards compatibility. They will be removed in the Queens cycle. + HostCpusList: + description: List of cores to be used for host process + type: string + constraints: + - allowed_pattern: "[0-9,-]+" + default: '0' + NeutronDpdkCoreList: + description: List of cores to be used for DPDK Poll Mode Driver + type: string + constraints: + - allowed_pattern: "[0-9,-]*" + default: '' + NeutronDpdkMemoryChannels: + description: Number of memory channels to be used for DPDK + type: string + constraints: + - allowed_pattern: "[0-9]*" + default: '' + NeutronDpdkSocketMemory: + default: '' + description: Memory allocated for each socket + type: string + deployment_actions: + default: ['CREATE', 'UPDATE'] + type: comma_delimited_list + description: > + List of stack actions that will trigger any deployments in this + templates. The actions will be an empty list of the server is in the + toplevel DeploymentServerBlacklist parameter's value. conditions: is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}} + is_dpdk_config_required: + or: + - yaql: + expression: $.data.service_names.contains('neutron_ovs_dpdk_agent') + data: + service_names: {get_param: ServiceNames} + - {equals: [{get_param: [RoleParameters, OvsEnableDpdk]}, true]} + is_reboot_config_required: + or: + - is_host_config_required + - is_dpdk_config_required + l_cores_empty: {equals: [{get_param: OvsDpdkCoreList}, '']} + pmd_cores_empty: {equals: [{get_param: OvsPmdCoreList}, '']} + mem_channels_empty: {equals: [{get_param: OvsDpdkMemoryChannels}, '']} + socket_mem_empty: {equals: [{get_param: OvsDpdkSocketMemory}, '']} + deployment_actions_empty: + equals: + - {get_param: deployment_actions} + - [] resources: + RoleParametersValue: + type: OS::Heat::Value + properties: + type: json + value: + map_replace: + - map_replace: + - OvsDpdkCoreList: OvsDpdkCoreList + OvsDpdkMemoryChannels: OvsDpdkMemoryChannels + OvsDpdkSocketMemory: OvsDpdkSocketMemory + OvsPmdCoreList: OvsPmdCoreList + - values: {get_param: [RoleParameters]} + - values: + OvsDpdkCoreList: {if: [l_cores_empty, {get_param: HostCpusList}, {get_param: OvsDpdkCoreList}]} + OvsDpdkMemoryChannels: {if: [mem_channels_empty, {get_param: NeutronDpdkMemoryChannels}, {get_param: OvsDpdkMemoryChannels}]} + OvsDpdkSocketMemory: {if: [socket_mem_empty, {get_param: NeutronDpdkSocketMemory}, {get_param: OvsDpdkSocketMemory}]} + OvsPmdCoreList: {if: [pmd_cores_empty, {get_param: NeutronDpdkCoreList}, {get_param: OvsPmdCoreList}]} + HostParametersConfig: type: OS::Heat::SoftwareConfig condition: is_host_config_required @@ -37,15 +149,85 @@ resources: name: HostParametersDeployment server: {get_param: server} config: {get_resource: HostParametersConfig} - actions: ['CREATE'] # Only do this on CREATE + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE input_values: _KERNEL_ARGS_: {get_param: [RoleParameters, KernelArgs]} _TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]} - _TUNED_CORES_: {get_param: [RoleParameters, HostIsolatedCoreList]} + _TUNED_CORES_: {get_param: [RoleParameters, IsolCpusList]} + + EnableDpdkConfig: + type: OS::Heat::SoftwareConfig + condition: is_dpdk_config_required + properties: + group: script + config: + str_replace: + template: | + #!/bin/bash + set -x + + # OvS Permission issue temporary workaround + # https://bugzilla.redhat.com/show_bug.cgi?id=1459436 + # Actual solution from openvswitch - https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/333423.html + ovs_service_path="/usr/lib/systemd/system/ovs-vswitchd.service" + + if grep -q 'RuntimeDirectoryMode' $ovs_service_path; then + sed -i 's/RuntimeDirectoryMode=.*/RuntimeDirectoryMode=0775/' $ovs_service_path + else + echo "RuntimeDirectoryMode=0775" >> $ovs_service_path + fi + + if ! grep -Fxq "Group=qemu" $ovs_service_path ; then + echo "Group=qemu" >> $ovs_service_path + fi + + if ! grep -Fxq "UMask=0002" $ovs_service_path ; then + echo "UMask=0002" >> $ovs_service_path + fi + + ovs_ctl_path='/usr/share/openvswitch/scripts/ovs-ctl' + if ! grep -q "umask 0002 \&\& start_daemon \"\$OVS_VSWITCHD_PRIORITY\"" $ovs_ctl_path ; then + sed -i 's/start_daemon \"\$OVS_VSWITCHD_PRIORITY\"/umask 0002 \&\& start_daemon \"$OVS_VSWITCHD_PRIORITY\"/' $ovs_ctl_path + fi + + + # DO NOT use --detailed-exitcodes + puppet apply --logdest console \ + --modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules \ + -e ' + class {"vswitch::dpdk": + host_core_list => "$HOST_CORES", + pmd_core_list => "$PMD_CORES", + memory_channels => "$MEMORY_CHANNELS", + socket_mem => "$SOCKET_MEMORY", + } + ' + params: + $HOST_CORES: {get_attr: [RoleParametersValue, value, OvsDpdkCoreList]} + $PMD_CORES: {get_attr: [RoleParametersValue, value, OvsPmdCoreList]} + $MEMORY_CHANNELS: {get_attr: [RoleParametersValue, value, OvsDpdkMemoryChannels]} + $SOCKET_MEMORY: {get_attr: [RoleParametersValue, value, OvsDpdkSocketMemory]} + + EnableDpdkDeployment: + type: OS::Heat::SoftwareDeployment + condition: is_dpdk_config_required + properties: + name: EnableDpdkDeployment + server: {get_param: server} + config: {get_resource: EnableDpdkConfig} + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE RebootConfig: type: OS::Heat::SoftwareConfig - condition: is_host_config_required + condition: is_reboot_config_required properties: group: script config: | @@ -58,12 +240,16 @@ resources: RebootDeployment: type: OS::Heat::SoftwareDeployment depends_on: HostParametersDeployment - condition: is_host_config_required + condition: is_reboot_config_required properties: name: RebootDeployment server: {get_param: server} config: {get_resource: RebootConfig} - actions: ['CREATE'] # Only do this on CREATE + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE signal_transport: NO_SIGNAL outputs: diff --git a/extraconfig/tasks/pacemaker_common_functions.sh b/extraconfig/tasks/pacemaker_common_functions.sh index d1dd5d1d..367f50d7 100755 --- a/extraconfig/tasks/pacemaker_common_functions.sh +++ b/extraconfig/tasks/pacemaker_common_functions.sh @@ -371,3 +371,15 @@ function fixup_wrong_ipv6_vip { fi ) } + +# https://bugs.launchpad.net/tripleo/+bug/1704131 guard against yum update +# waiting for an existing process until the heat stack time out +function check_for_yum_lock { + if [[ -f /var/run/yum.pid ]] ; then + ERR="ERROR existing yum.pid detected - can't continue! Please ensure +there is no other package update process for the duration of the minor update +worfklow. Exiting." + echo $ERR + exit 1 + fi +} diff --git a/extraconfig/tasks/post_puppet_pacemaker.j2.yaml b/extraconfig/tasks/post_puppet_pacemaker.j2.yaml index 6bf5afb0..4d34aedf 100644 --- a/extraconfig/tasks/post_puppet_pacemaker.j2.yaml +++ b/extraconfig/tasks/post_puppet_pacemaker.j2.yaml @@ -27,6 +27,7 @@ resources: {{role.name}}PostPuppetMaintenanceModeDeployment: type: OS::Heat::SoftwareDeployments properties: + name: {{role.name}}PostPuppetMaintenanceModeDeployment servers: {get_param: [servers, {{role.name}}]} config: {get_resource: {{role.name}}PostPuppetMaintenanceModeConfig} input_values: {get_param: input_values} diff --git a/extraconfig/tasks/post_puppet_pacemaker_restart.yaml b/extraconfig/tasks/post_puppet_pacemaker_restart.yaml index 203ca1f8..102be8a8 100644 --- a/extraconfig/tasks/post_puppet_pacemaker_restart.yaml +++ b/extraconfig/tasks/post_puppet_pacemaker_restart.yaml @@ -23,6 +23,7 @@ resources: ControllerPostPuppetRestartDeployment: type: OS::Heat::SoftwareDeployments properties: + name: ControllerPostPuppetRestartDeployment servers: {get_param: servers} config: {get_resource: ControllerPostPuppetRestartConfig} input_values: {get_param: input_values} diff --git a/extraconfig/tasks/ssh/host_public_key.yaml b/extraconfig/tasks/ssh/host_public_key.yaml index e4ba0cc4..ee06f0a9 100644 --- a/extraconfig/tasks/ssh/host_public_key.yaml +++ b/extraconfig/tasks/ssh/host_public_key.yaml @@ -7,6 +7,13 @@ parameters: server: description: ID of the node to apply this config to type: string + deployment_actions: + default: ['CREATE', 'UPDATE'] + type: comma_delimited_list + description: > + List of stack actions that will trigger any deployments in this + templates. The actions will be an empty list of the server is in the + toplevel DeploymentServerBlacklist parameter's value. resources: SshHostPubKeyConfig: @@ -28,6 +35,8 @@ resources: properties: config: {get_resource: SshHostPubKeyConfig} server: {get_param: server} + actions: {get_param: deployment_actions} + name: SshHostPubKeyDeployment outputs: diff --git a/extraconfig/tasks/yum_update.sh b/extraconfig/tasks/yum_update.sh index 0c4a7928..a2a04e8e 100755 --- a/extraconfig/tasks/yum_update.sh +++ b/extraconfig/tasks/yum_update.sh @@ -64,6 +64,9 @@ fi command_arguments=${command_arguments:-} +# Always ensure yum has full cache +yum makecache || echo "Yum makecache failed. This can cause failure later on." + # yum check-update exits 100 if updates are available set +e check_update=$(yum check-update 2>&1) @@ -93,6 +96,7 @@ if [[ "$pacemaker_status" == "active" ]] ; then fi else echo "Upgrading openstack-puppet-modules and its dependencies" + check_for_yum_lock yum -q -y update openstack-puppet-modules yum deplist openstack-puppet-modules | awk '/dependency/{print $2}' | xargs yum -q -y update echo "Upgrading other packages is handled by config management tooling" @@ -102,8 +106,9 @@ fi command=${command:-update} full_command="yum -q -y $command $command_arguments" -echo "Running: $full_command" +echo "Running: $full_command" +check_for_yum_lock result=$($full_command) return_code=$? echo "$result" |