From 67230431c6db60b7ff629c77b226390ef9d54bc8 Mon Sep 17 00:00:00 2001 From: Elena Ezhova Date: Tue, 14 Feb 2017 16:09:06 +0400 Subject: [PATCH] Add SR-IOV support * Add Neutron SR-IOV NIC switch agent * Add config options for ccp.yaml Change-Id: I1125ff53e3d980c5a37d270c328206bd9a71f92f --- docker/neutron-sriov-nic-agent/Dockerfile.j2 | 2 + service/files/defaults.yaml | 2 + service/files/ml2_conf.ini.j2 | 4 ++ service/files/sriov_agent.ini.j2 | 44 ++++++++++++++++++++ service/neutron-sriov-nic-agent.yaml | 34 +++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 docker/neutron-sriov-nic-agent/Dockerfile.j2 create mode 100644 service/files/sriov_agent.ini.j2 create mode 100644 service/neutron-sriov-nic-agent.yaml diff --git a/docker/neutron-sriov-nic-agent/Dockerfile.j2 b/docker/neutron-sriov-nic-agent/Dockerfile.j2 new file mode 100644 index 0000000..cf40e58 --- /dev/null +++ b/docker/neutron-sriov-nic-agent/Dockerfile.j2 @@ -0,0 +1,2 @@ +FROM {{ image_spec("neutron-base") }} +MAINTAINER {{ maintainer }} diff --git a/service/files/defaults.yaml b/service/files/defaults.yaml index af04eb5..e30818b 100644 --- a/service/files/defaults.yaml +++ b/service/files/defaults.yaml @@ -35,6 +35,8 @@ configs: connection: "unix:/run/openvswitch/db.sock" enable_lbaas: false enable_qos: false + sriov: + enabled: false calico: etcd_host: "etcd-k8s" etcd_port: 2379 diff --git a/service/files/ml2_conf.ini.j2 b/service/files/ml2_conf.ini.j2 index 969a815..437c23f 100644 --- a/service/files/ml2_conf.ini.j2 +++ b/service/files/ml2_conf.ini.j2 @@ -10,7 +10,11 @@ tenant_network_types = {{ neutron.ml2.tenant_network_types|join(',') }} {% endif %} {% if neutron.plugin_agent == "openvswitch" %} +{% if neutron.sriov.enabled %} +mechanism_drivers = openvswitch,sriovnicswitch +{% else %} mechanism_drivers = openvswitch,l2population +{% endif %} {% elif neutron.plugin_agent == "linuxbridge" %} mechanism_drivers = linuxbridge,l2population {% elif neutron.plugin_agent == "calico" %} diff --git a/service/files/sriov_agent.ini.j2 b/service/files/sriov_agent.ini.j2 new file mode 100644 index 0000000..6ea31a8 --- /dev/null +++ b/service/files/sriov_agent.ini.j2 @@ -0,0 +1,44 @@ +[agent] + +{% if neutron.enable_qos %} +extensions = qos +{% endif %} + + +[securitygroup] +firewall_driver = neutron.agent.firewall.NoopFirewallDriver + +[sriov_nic] + +# +# From neutron.ml2.sriov.agent +# + +# Comma-separated list of : tuples mapping +# physical network names to the agent's node-specific physical network device +# interfaces of SR-IOV physical function to be used for VLAN networks. All +# physical networks listed in network_vlan_ranges on the server should have +# mappings to appropriate interfaces on each agent. (list value) +physical_device_mappings = +{%- for dev in neutron.sriov.devices -%} +{%- for net in dev.physnets -%} +{%- if not loop.first %},{% endif -%} +{{ net }}:{{ dev.name }} +{%- endfor %} +{%- endfor %} + +# Comma-separated list of : tuples, mapping +# network_device to the agent's node-specific list of virtual functions that +# should not be used for virtual networking. vfs_to_exclude is a semicolon- +# separated list of virtual functions to exclude from network_device. The +# network_device in the mapping should appear in the physical_device_mappings +# list. (list value) +exclude_devices = +{%- for dev in neutron.sriov.devices if dev.exclude_vfs -%} +{%- if not loop.first %},{% endif -%} +{{ dev.name }}: +{%- for vf in dev.exclude_vfs -%} +{%- if not loop.first %};{% endif -%} +{{ vf }} +{%- endfor %} +{%- endfor %} diff --git a/service/neutron-sriov-nic-agent.yaml b/service/neutron-sriov-nic-agent.yaml new file mode 100644 index 0000000..5ffb06b --- /dev/null +++ b/service/neutron-sriov-nic-agent.yaml @@ -0,0 +1,34 @@ +dsl_version: 0.1.0 +service: + name: neutron-sriov-nic-agent + kind: DaemonSet + hostNetwork: true + containers: + - name: neutron-sriov-nic-agent + image: neutron-sriov-nic-agent + privileged: true + volumes: + - name: ovs-socket + type: host + path: /run/openvswitch + - name: modules + type: host + path: /lib/modules + daemon: + command: neutron-sriov-nic-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/sriov_agent.ini + dependencies: + - neutron-db-sync + - rpc + - notifications + files: + - neutron.conf + - sriov_agent.ini +files: + neutron.conf: + path: /etc/neutron/neutron.conf + content: neutron.conf.j2 + perm: "0600" + sriov_agent.ini: + path: /etc/neutron/plugins/ml2/sriov_agent.ini + content: sriov_agent.ini.j2 + perm: "0600"