diff options
author | Feng Pan <fpan@redhat.com> | 2017-09-26 23:33:08 -0400 |
---|---|---|
committer | Feng Pan <fpan@redhat.com> | 2017-09-28 00:08:28 -0400 |
commit | 68095d704d1aea94f5890f54eefa13929aab737c (patch) | |
tree | 1d81c569dcd3a18d3d24a26d3560443a5f26355a | |
parent | 7af8cf039ef21da528a8cb53e0eb78c1b6878714 (diff) |
Fix RT KVM scenario
Also change first-boot.yaml to handle updated kernel for rt kvm
Change-Id: I66b7159731dd286c4a97ba4f3583e229afbb73b3
Signed-off-by: Feng Pan <fpan@redhat.com>
-rw-r--r-- | apex/overcloud/overcloud_deploy.py | 22 | ||||
-rw-r--r-- | build/enable_rt_kvm.yaml | 4 | ||||
-rw-r--r-- | build/first-boot.yaml | 63 | ||||
-rwxr-xr-x | build/undercloud.sh | 3 |
4 files changed, 62 insertions, 30 deletions
diff --git a/apex/overcloud/overcloud_deploy.py b/apex/overcloud/overcloud_deploy.py index 20fb4a60..99311748 100644 --- a/apex/overcloud/overcloud_deploy.py +++ b/apex/overcloud/overcloud_deploy.py @@ -100,7 +100,6 @@ def create_deploy_cmd(ds, ns, inv, tmp_dir, ds_opts = ds['deploy_options'] deploy_options += build_sdn_env_list(ds_opts, SDN_FILE_MAP) - # TODO(trozet): make sure rt kvm file is in tht dir for k, v in OTHER_FILE_MAP.items(): if k in ds_opts and ds_opts[k]: deploy_options.append(os.path.join(con.THT_ENV_DIR, v)) @@ -418,17 +417,16 @@ def prep_env(ds, ns, opnfv_env, net_env, tmp_dir): ds_opts['dataplane'] == 'ovs_dpdk': print(' OS::TripleO::ComputeExtraConfigPre: ' './ovs-dpdk-preconfig.yaml') - elif perf and perf_kern_comp: - if 'resource_registry' in line: - print("resource_registry:\n" - " OS::TripleO::NodeUserData: first-boot.yaml") - elif 'NovaSchedulerDefaultFilters' in line: - print(" NovaSchedulerDefaultFilters: 'RamFilter," - "ComputeFilter,AvailabilityZoneFilter," - "ComputeCapabilitiesFilter,ImagePropertiesFilter," - "NUMATopologyFilter'") - else: - print(line) + elif ((perf and perf_kern_comp) or ds_opts.get('rt_kvm')) and \ + 'resource_registry' in line: + print("resource_registry:\n" + " OS::TripleO::NodeUserData: first-boot.yaml") + elif perf and perf_kern_comp and \ + 'NovaSchedulerDefaultFilters' in line: + print(" NovaSchedulerDefaultFilters: 'RamFilter," + "ComputeFilter,AvailabilityZoneFilter," + "ComputeCapabilitiesFilter,ImagePropertiesFilter," + "NUMATopologyFilter'") else: print(line) diff --git a/build/enable_rt_kvm.yaml b/build/enable_rt_kvm.yaml index 4601fd40..35a00d7d 100644 --- a/build/enable_rt_kvm.yaml +++ b/build/enable_rt_kvm.yaml @@ -1,5 +1,3 @@ --- parameter_defaults: - ComputeKernelArgs: 'kvmfornfv_kernel.rpm' -resource_registry: - OS::TripleO::NodeUserData: kvm4nfv-1st-boot.yaml + KVMForNFVKernelRPM: 'kvmfornfv_kernel.rpm' diff --git a/build/first-boot.yaml b/build/first-boot.yaml index 1e8921ba..582981c0 100644 --- a/build/first-boot.yaml +++ b/build/first-boot.yaml @@ -16,6 +16,15 @@ parameters: "intel_iommu=on default_hugepagesz=2MB hugepagesz=2MB hugepages=2048" type: string default: "" + KVMForNFVKernelRPM: + description: > + Name of the kvmfornfv kernel rpm. + Example: "kvmfornfv_kernel.rpm" + type: string + default: "" + ComputeHostnameFormat: + type: string + default: "" resources: userdata: @@ -33,23 +42,51 @@ resources: template: | #!/bin/bash set -x - sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS"/g' \ - -i /etc/default/grub ; - grub2-mkconfig -o /etc/grub2.cfg - hugepage_count=$(echo $KERNEL_ARGS | \ - grep -oP ' ?hugepages=\K[0-9]+') - if [ -z "$hugepage_count" ]; then - hugepage_count=1024 + need_reboot='false' + + if [ -n "$KERNEL_ARGS" ]; then + sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"/\1 $KERNEL_ARGS"/g' \ + -i /etc/default/grub ; + grub2-mkconfig -o /etc/grub2.cfg + hugepage_count=$(echo $KERNEL_ARGS | \ + grep -oP ' ?hugepages=\K[0-9]+') + if [ -z "$hugepage_count" ]; then + hugepage_count=1024 + fi + echo vm.hugetlb_shm_group=0 >> /usr/lib/sysctl.d/00-system.conf + HPAGE_CT=$(printf "%.0f" $(echo 2.2*$hugepage_count | bc)) + echo vm.max_map_count=$HPAGE_CT >> \ + /usr/lib/sysctl.d/00-system.conf + HPAGE_CT=$(($hugepage_count * 2 * 1024 * 1024)) + echo kernel.shmmax=$HPAGE_CT >> /usr/lib/sysctl.d/00-system.conf + need_reboot='true' + fi + + if [ -n "$KVMFORNFV_KERNEL_RPM" ]; then + FORMAT=$COMPUTE_HOSTNAME_FORMAT + if [[ -z $FORMAT ]] ; then + FORMAT="compute" ; + else + # Assumption: only %index% and %stackname% are + # the variables in Host name format + FORMAT=$(echo $FORMAT | sed 's/\%index\%//g'); + FORMAT=$(echo $FORMAT | sed 's/\%stackname\%//g'); + fi + if [[ $(hostname) == *$FORMAT* ]] ; then + yum install -y /root/$KVMFORNFV_KERNEL_RPM + grub2-mkconfig -o /etc/grub2.cfg + sleep 5 + need_reboot='true' + fi fi - echo vm.hugetlb_shm_group=0 >> /usr/lib/sysctl.d/00-system.conf - HPAGE_CT=$(printf "%.0f" $(echo 2.2*$hugepage_count | bc)) - echo vm.max_map_count=$HPAGE_CT >> /usr/lib/sysctl.d/00-system.conf - HPAGE_CT=$(($hugepage_count * 2 * 1024 * 1024)) - echo kernel.shmmax=$HPAGE_CT >> /usr/lib/sysctl.d/00-system.conf - reboot + if [ "$need_reboot" == "true" ]; then + reboot + fi params: $KERNEL_ARGS: {get_param: ComputeKernelArgs} + $KVMFORNFV_KERNEL_RPM: {get_param: KVMForNFVKernelRPM} + $COMPUTE_HOSTNAME_FORMAT: {get_param: ComputeHostnameFormat} outputs: OS::stack_id: diff --git a/build/undercloud.sh b/build/undercloud.sh index bd494fb4..ecd9c9fb 100755 --- a/build/undercloud.sh +++ b/build/undercloud.sh @@ -45,8 +45,7 @@ LIBGUESTFS_BACKEND=direct virt-customize \ --run-command "cp /usr/share/instack-undercloud/undercloud.conf.sample /home/stack/undercloud.conf && chown stack:stack /home/stack/undercloud.conf" \ --upload ${BUILD_ROOT}/opnfv-environment.yaml:/home/stack/ \ --upload ${BUILD_ROOT}/first-boot.yaml:/home/stack/ \ - --upload ${BUILD_ROOT}/kvm4nfv-1st-boot.yaml:/home/stack/ \ - --upload ${BUILD_DIR}/enable_rt_kvm.yaml:/home/stack/ \ + --upload ${BUILD_DIR}/enable_rt_kvm.yaml:/usr/share/openstack-tripleo-heat-templates/environments/ \ --upload ${BUILD_ROOT}/ovs-dpdk-preconfig.yaml:/home/stack/ \ --upload ${BUILD_ROOT}/csit-environment.yaml:/home/stack/ \ --upload ${BUILD_ROOT}/virtual-environment.yaml:/home/stack/ \ |