Skip to content

Commit

Permalink
SRIOV support for helm charts
Browse files Browse the repository at this point in the history
Change-Id: Id6dc555ba91531f49ba69f7019093a8ce515158e
Partial-bug: #1767470
(cherry picked from commit f817ed5)
  • Loading branch information
madhukar32 authored and mnayakbomman@juniper.net committed Jul 31, 2018
1 parent 881f606 commit d871e5f
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 4 deletions.
25 changes: 25 additions & 0 deletions playbooks/osh-setup-grub.yaml
@@ -0,0 +1,25 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: all
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: False
become: yes
roles:
- setup-grub
tags:
- setup-grub
2 changes: 0 additions & 2 deletions playbooks/vars.yaml
Expand Up @@ -52,8 +52,6 @@ nodes:
value: enabled
- name: openstack-compute-node
value: enabled
- name: openvswitch
value: enabled
- name: linuxbridge
value: enabled
- name: ceph-mon
Expand Down
65 changes: 65 additions & 0 deletions roles/setup-grub/tasks/main.yaml
@@ -0,0 +1,65 @@
# enable IOMMU if sriov/vfio-dpdk is enabled
- name: set grub file name
stat:
path: "/etc/default/grub"
register: file_rc

- name: set SRIOV data
set_fact:
contrail_modify_grub: 'True'
contrail_grub_cmd_line: 'nomdmonddf nomdmonisw intel_iommu=on'
when: "'contrail-vrouter-sriov' in group_names"

- name: set VFIO-DPDK data
set_fact:
contrail_modify_grub: 'True'
contrail_grub_cmd_line: 'intel_iommu=on iommu=pt'
when: "'contrail-vrouter-dpdk' in group_names and
(DPDK_UIO_DRIVER is defined and
(DPDK_UIO_DRIVER == 'vfio_pci' or DPDK_UIO_DRIVER == 'vfio-pci'))"

- name: Remove the SRIOV/VFIO config if present - to fix limiation in lineinfile
replace:
path: "/etc/default/grub"
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=\"((.*))(( {{ contrail_grub_cmd_line}}))\"'
replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1"'
register: contrail_grub_restored
when: contrail_modify_grub is defined and file_rc.stat.exists == true

- name: Modify grub to include iommu for SRIOV and VFIO-DPDK
replace:
path: "/etc/default/grub"
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=\"((.*))(( {{ contrail_grub_cmd_line}})|(?<! {{contrail_grub_cmd_line}}))\"'
replace: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 {{ contrail_grub_cmd_line }}"'
register: contrail_grub_modified
when: contrail_modify_grub is defined and file_rc.stat.exists == true

- name: Add iommu for grub for SRIOV and VFIO-DPDK
lineinfile:
path: "/etc/default/grub"
line: 'GRUB_CMDLINE_LINUX_DEFAULT=" {{contrail_grub_cmd_line}}"'
insertafter: EOF
register: contrail_grub_added
when: contrail_modify_grub is defined and file_rc.stat.exists == true and contrail_grub_modified.changed == false

- name: execute update-grub/sys
command: update-grub
register: gstat
when:
- contrail_modify_grub is defined
- file_rc.stat.exists == true
- ((contrail_grub_restored.changed == false and contrail_grub_modified.changed == true) or
(contrail_grub_added.changed == true))

- name: restart server
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
async: 1
poll: 0
become: true
when: (contrail_modify_grub is defined and gstat is defined and gstat.changed)

- name: wait for server to come back online
wait_for_connection:
delay: 30
timeout: 2400
when: (contrail_modify_grub is defined and gstat is defined and gstat.changed)
32 changes: 31 additions & 1 deletion tools/gate/devel/local-vars.yaml
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

version:
kubernetes: v1.8.3
kubernetes: v1.9.3
helm: v2.7.2
cni: v0.6.0

Expand All @@ -29,3 +29,33 @@ kubernetes:
cni: calico
pod_subnet: 192.168.0.0/16
domain: cluster.local

nodes:
labels:
primary:
- name: openstack-helm-node-class
value: primary
nodes:
- name: openstack-helm-node-class
value: general
all:
- name: openstack-control-plane
value: enabled
- name: openstack-compute-node
value: enabled
- name: linuxbridge
value: enabled
- name: ceph-mon
value: enabled
- name: ceph-osd
value: enabled
- name: ceph-mds
value: enabled
- name: ceph-rgw
value: enabled
- name: ceph-mgr
value: enabled
- name: opencontrail.org/controller
value: enabled
- name: opencontrail.org/vrouter-kernel
value: enabled
74 changes: 74 additions & 0 deletions tools/gate/devel/sample-contrail-multinode-inventory.yaml
@@ -0,0 +1,74 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

all:
children:
primary:
hosts:
node1:
ansible_port: 22
ansible_host: 10.10.10.13
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
nodes:
children:
contrail-controller:
hosts:
node2:
ansible_port: 22
ansible_host: 10.10.10.14
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
node3:
ansible_port: 22
ansible_host: 10.10.10.15
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
node4:
ansible_port: 22
ansible_host: 10.10.10.16
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
openstack-compute:
children:
contrial-vrouter-kernel:
hosts:
node5:
ansible_port: 22
ansible_host: 10.10.10.17
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
contrail-vrouter-dpdk:
hosts:
node6:
ansible_port: 22
ansible_host: 10.10.10.18
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
vars:
DPDK_UIO_DRIVER: vfio-pci
contrail-vrouter-sriov:
hosts:
node7:
ansible_port: 22
ansible_host: 10.10.10.19
ansible_user: ubuntu
ansible_ssh_private_key_file: /home/ubuntu/.ssh/insecure.pem
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
65 changes: 65 additions & 0 deletions tools/gate/devel/sample-contrail-multinode-vars.yaml
@@ -0,0 +1,65 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version:
kubernetes: v1.9.3
helm: v2.7.2
cni: v0.6.0

kubernetes:
network:
default_device: enp0s8
cluster:
cni: calico
pod_subnet: 192.168.0.0/16
domain: cluster.local
docker:
insecure_registries:
- "10.84.5.81:5000"

nodes:
labels:
primary:
- name: openstack-helm-node-class
value: primary
- name: openstack-control-plane
value: enabled
- name: ceph-mon
value: enabled
- name: ceph-osd
value: enabled
- name: ceph-mds
value: enabled
- name: ceph-rgw
value: enabled
- name: ceph-mgr
value: enabled
all:
- name: openstack-helm-node-class
value: general
contrail-controller:
- name: opencontrail.org/controller
value: enabled
openstack-compute:
- name: openstack-compute-node
value: enabled
contrial-vrouter-kernel:
- name: opencontrail.org/vrouter-kernel
value: enabled
contrail-vrouter-dpdk:
- name: opencontrail.org/vrouter-dpdk
value: enabled
contrail-vrouter-sriov:
- name: vrouter-sriov
value: enabled
2 changes: 1 addition & 1 deletion tools/gate/devel/start.sh
Expand Up @@ -67,7 +67,7 @@ function ansible_install {

if [ "x${DEPLOY}" == "xsetup-host" ]; then
ansible_install
PLAYBOOKS="osh-infra-docker"
PLAYBOOKS="osh-setup-grub osh-infra-docker"
elif [ "x${DEPLOY}" == "xk8s" ]; then
PLAYBOOKS="osh-infra-build osh-infra-deploy-k8s osh-k8s-create-image-secret"
elif [ "x${DEPLOY}" == "xcharts" ]; then
Expand Down

0 comments on commit d871e5f

Please sign in to comment.