From 3a322fbc551c6f552c64aff810e0a752d721cb3a Mon Sep 17 00:00:00 2001 From: Ivan Chavero Date: Tue, 18 Aug 2015 12:45:25 -0600 Subject: [PATCH] Add support for Neutron ML2 SR-IOV mechanism driver Change-Id: Ifbd446b4399f26630f9c9b4f3658dda277f49f38 Resolves: rhbz#1167099 --- docs/packstack.rst | 20 ++++- packstack/plugins/neutron_350.py | 73 ++++++++++++++++++- packstack/plugins/nova_300.py | 29 ++++++++ .../puppet/templates/neutron_ml2_plugin.pp | 20 ++--- packstack/puppet/templates/neutron_sriov.pp | 3 + packstack/puppet/templates/nova_api.pp | 1 + packstack/puppet/templates/nova_compute.pp | 1 + 7 files changed, 136 insertions(+), 11 deletions(-) create mode 100644 packstack/puppet/templates/neutron_sriov.pp diff --git a/docs/packstack.rst b/docs/packstack.rst index 26c465c52..bc8e1649a 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -718,6 +718,14 @@ Nova Options **CONFIG_NOVA_COMPUTE_MANAGER** Manager that runs the Compute service. +**CONFIG_NOVA_PCI_ALIAS** + Enter the PCI passthrough array of hash in JSON style for controller eg. + [{"vendor_id":"1234", "product_id":"5678", "name":"default"}, {...}] + +**CONFIG_NOVA_PCI_PASSTHROUGH_WHITELIST** + Enter the PCI passthrough whitelist array of hash in JSON style for controller eg. + [{"vendor_id":"1234", "product_id":"5678", "name':"default"}, {...}] + **CONFIG_VNC_SSL_CERT** PEM encoded certificate to be used for ssl on the https server, leave blank if one should be generated, this certificate should not require a passphrase. If CONFIG_HORIZON_SSL is set to 'n' this parameter is ignored. @@ -797,7 +805,7 @@ Neutron ML2 plugin config Comma-separated, ordered list of network types to allocate as tenant networks. The 'local' value is only useful for single-box testing and provides no connectivity between hosts. ['local', 'vlan', 'gre', 'vxlan'] **CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS** - Comma-separated ordered list of networking mechanism driver entry points to be loaded from the neutron.ml2.mechanism_drivers namespace. ['logger', 'test', 'linuxbridge', 'openvswitch', 'hyperv', 'ncs', 'arista', 'cisco_nexus', 'mlnx', 'l2population'] + Comma-separated ordered list of networking mechanism driver entry points to be loaded from the neutron.ml2.mechanism_drivers namespace. ['logger', 'test', 'linuxbridge', 'openvswitch', 'hyperv', 'ncs', 'arista', 'cisco_nexus', 'mlnx', 'l2population', 'sriovnicswitch'] **CONFIG_NEUTRON_ML2_FLAT_NETWORKS** Comma-separated list of physical_network names with which flat networks can be created. Use * to allow flat networks with arbitrary physical_network names. @@ -811,9 +819,19 @@ Neutron ML2 plugin config **CONFIG_NEUTRON_ML2_VXLAN_GROUP** Comma-separated list of addresses for VXLAN multicast group. If left empty, disables VXLAN from sending allocate broadcast traffic (disables multicast VXLAN mode). Should be a Multicast IP (v4 or v6) address. +**CONFIG_NEUTRON_ML2_SUPPORTED_PCI_VENDOR_DEVS** + Comma separated list of supported PCI vendor devices defined by vendor_id:product_id according to the PCI ID Repository. + **CONFIG_NEUTRON_ML2_VNI_RANGES** Comma-separated list of : tuples enumerating ranges of VXLAN VNI IDs that are available for tenant network allocation. Minimum value is 0 and maximum value is 16777215. +**CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED** + Specify 'y' if the sriov agent is required + +**CONFIG_NEUTRON_ML2_SRIOV_INTERFACE_MAPPINGS** + Comma-separated list of interface mappings for the OpenStack Networking ML2 SRIOV agent. Each tuple in the list must be in the format :. Example: physnet1:eth1,physnet2:eth2,physnet3:eth3. + + **CONFIG_NEUTRON_L2_AGENT** Name of the L2 agent to be used with OpenStack Networking. ['linuxbridge', 'openvswitch'] diff --git a/packstack/plugins/neutron_350.py b/packstack/plugins/neutron_350.py index d02b2fc5e..3bee3211d 100644 --- a/packstack/plugins/neutron_350.py +++ b/packstack/plugins/neutron_350.py @@ -247,7 +247,7 @@ def initConfig(controller): "mechanism driver entrypoints"), "OPTION_LIST": ["logger", "test", "linuxbridge", "openvswitch", "hyperv", "ncs", "arista", "cisco_nexus", - "mlnx", "l2population"], + "mlnx", "l2population", "sriovnicswitch"], "VALIDATORS": [validators.validate_multi_options], "DEFAULT_VALUE": "openvswitch", "MASK_INPUT": False, @@ -335,6 +335,44 @@ def initConfig(controller): "USE_DEFAULT": False, "NEED_CONFIRM": False, "CONDITION": False}, + {"CMD_OPTION": "os-neutron-ml2-supported-pci-vendor-devs", + "CONF_NAME": "CONFIG_NEUTRON_ML2_SUPPORTED_PCI_VENDOR_DEVS", + "PROMPT": ("Enter a comma separated list of supported PCI " + "vendor devices, defined by vendor_id:product_id " + "according to the PCI ID Repository."), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": ['15b3:1004', '8086:10ca'], + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "os-neutron-ml2-sriov-agent-required", + "CONF_NAME": "CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED", + "PROMPT": ("Set to y if the sriov agent is required"), + "OPTION_LIST": ["y", "n"], + "VALIDATORS": [validators.validate_options], + "DEFAULT_VALUE": "n", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "os-neutron-ml2-sriov-interface-mappings", + "PROMPT": ("Enter a comma separated list of interface mappings " + "for the Neutron ML2 sriov agent"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_NEUTRON_ML2_SRIOV_INTERFACE_MAPPINGS", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, ], } update_params_usage(basedefs.PACKSTACK_DOC, conf_params) @@ -397,6 +435,12 @@ def initSequences(controller): config['CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'] += 'openvswitch' config['CONFIG_NEUTRON_ML2_FLAT_NETWORKS'] = 'physnet1' + if use_ml2_with_sriovnicswitch(config): + if ('openvswitch' not in config['CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'] + and 'linuxbridge' not in + config['CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS']): + config['CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'] += ', openvswitch' + plugin_db = 'neutron' plugin_path = 'neutron.plugins.ml2.plugin.Ml2Plugin' # values modification @@ -425,6 +469,11 @@ def initSequences(controller): compute_hosts = split_hosts(config['CONFIG_COMPUTE_HOSTS']) q_hosts = api_hosts | network_hosts | compute_hosts + if config['CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED'] == 'y': + config['CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED'] = True + else: + config['CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED'] = False + neutron_steps = [ {'title': 'Adding Neutron VPNaaS Agent manifest entries', 'functions': [create_vpnaas_manifests]}, @@ -446,6 +495,8 @@ def initSequences(controller): 'functions': [create_metering_agent_manifests]}, {'title': 'Adding Neutron Metadata Agent manifest entries', 'functions': [create_metadata_manifests]}, + {'title': 'Adding Neutron SR-IOV Switch Agent manifest entries', + 'functions': [create_sriovnicswitch_manifests]}, {'title': 'Checking if NetworkManager is enabled and running', 'functions': [check_nm_status]}, ] @@ -486,6 +537,14 @@ def use_openvswitch_gre(config): return ml2_vxlan +def use_ml2_with_sriovnicswitch(config): + ml2_sriovnic = ( + use_ml2_with_ovs(config) and + 'sriovnicswitch' in config['CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'] + ) + return ml2_sriovnic + + def get_if_driver(config): agent = config['CONFIG_NEUTRON_L2_AGENT'] if agent == "openvswitch": @@ -803,6 +862,18 @@ def create_l2_agent_manifests(config, messages): appendManifestFile(manifestfile, manifestdata + '\n') +def create_sriovnicswitch_manifests(config, messages): + global compute_hosts + + if not use_ml2_with_sriovnicswitch(config): + return + + for host in compute_hosts: + manifestdata = getManifestTemplate("neutron_sriov") + manifestfile = "%s_neutron.pp" % (host,) + appendManifestFile(manifestfile, manifestdata + "\n") + + def create_metadata_manifests(config, messages): global network_hosts if config.get('CONFIG_NOVA_INSTALL') == 'n': diff --git a/packstack/plugins/nova_300.py b/packstack/plugins/nova_300.py index 784c4508d..4387c8050 100644 --- a/packstack/plugins/nova_300.py +++ b/packstack/plugins/nova_300.py @@ -173,6 +173,35 @@ def initConfig(controller): "USE_DEFAULT": False, "NEED_CONFIRM": False, "CONDITION": False}, + + {"CMD_OPTION": "nova-pci-alias", + "PROMPT": ("Enter the PCI passthrough array of hash in JSON style for controller eg. " + "[{'vendor_id':'1234', 'product_id':'5678', " + "'name':'default'}, {...}] "), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_NOVA_PCI_ALIAS", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "nova-pci-passthrough-whitelist", + "PROMPT": ("Enter the PCI passthrough whitelist as array of hash in JSON style for " + "controller eg. " + "[{'vendor_id':'1234', 'product_id':'5678', " + "'name':'default'}, {...}]"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_NOVA_PCI_PASSTHROUGH_WHITELIST", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, ], "NOVA_NETWORK": [ diff --git a/packstack/puppet/templates/neutron_ml2_plugin.pp b/packstack/puppet/templates/neutron_ml2_plugin.pp index 4049b3019..1d29d9052 100644 --- a/packstack/puppet/templates/neutron_ml2_plugin.pp +++ b/packstack/puppet/templates/neutron_ml2_plugin.pp @@ -6,15 +6,17 @@ if hiera('CONFIG_NEUTRON_ML2_VXLAN_GROUP') == '' { } class { '::neutron::plugins::ml2': - type_drivers => hiera_array('CONFIG_NEUTRON_ML2_TYPE_DRIVERS'), - tenant_network_types => hiera_array('CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES'), - mechanism_drivers => hiera_array('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'), - flat_networks => hiera_array('CONFIG_NEUTRON_ML2_FLAT_NETWORKS'), - network_vlan_ranges => hiera_array('CONFIG_NEUTRON_ML2_VLAN_RANGES'), - tunnel_id_ranges => hiera_array('CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES'), - vxlan_group => $vxlan_group_value, - vni_ranges => hiera_array('CONFIG_NEUTRON_ML2_VNI_RANGES'), - enable_security_group => true, + type_drivers => hiera_array('CONFIG_NEUTRON_ML2_TYPE_DRIVERS'), + tenant_network_types => hiera_array('CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES'), + mechanism_drivers => hiera_array('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS'), + flat_networks => hiera_array('CONFIG_NEUTRON_ML2_FLAT_NETWORKS'), + network_vlan_ranges => hiera_array('CONFIG_NEUTRON_ML2_VLAN_RANGES'), + tunnel_id_ranges => hiera_array('CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES'), + vxlan_group => $vxlan_group_value, + vni_ranges => hiera_array('CONFIG_NEUTRON_ML2_VNI_RANGES'), + enable_security_group => true, + supported_pci_vendor_devs => hiera_array('CONFIG_NEUTRON_ML2_SUPPORTED_PCI_VENDOR_DEVS'), + sriov_agent_required => hiera('CONFIG_NEUTRON_ML2_SRIOV_AGENT_REQUIRED'), } # For cases where "neutron-db-manage upgrade" command is called diff --git a/packstack/puppet/templates/neutron_sriov.pp b/packstack/puppet/templates/neutron_sriov.pp new file mode 100644 index 000000000..8c964efa5 --- /dev/null +++ b/packstack/puppet/templates/neutron_sriov.pp @@ -0,0 +1,3 @@ +class { 'neutron::agents::ml2::sriov' : + physical_device_mappings => hiera_array('CONFIG_NEUTRON_ML2_SRIOV_INTERFACE_MAPPINGS'), +} diff --git a/packstack/puppet/templates/nova_api.pp b/packstack/puppet/templates/nova_api.pp index 31882c259..fa119a799 100644 --- a/packstack/puppet/templates/nova_api.pp +++ b/packstack/puppet/templates/nova_api.pp @@ -22,6 +22,7 @@ class { '::nova::api': admin_password => hiera('CONFIG_NOVA_KS_PW'), neutron_metadata_proxy_shared_secret => hiera('CONFIG_NEUTRON_METADATA_PW_UNQUOTED', undef), default_floating_pool => $default_floating_pool, + pci_alias => hiera('CONFIG_NOVA_PCI_ALIAS'), } Package<| title == 'nova-common' |> -> Class['nova::api'] diff --git a/packstack/puppet/templates/nova_compute.pp b/packstack/puppet/templates/nova_compute.pp index 2459367a1..a353e1a08 100644 --- a/packstack/puppet/templates/nova_compute.pp +++ b/packstack/puppet/templates/nova_compute.pp @@ -41,6 +41,7 @@ class { '::nova::compute': vncproxy_protocol => hiera('CONFIG_VNCPROXY_PROTOCOL'), vncserver_proxyclient_address => $vncproxy_server, compute_manager => hiera('CONFIG_NOVA_COMPUTE_MANAGER'), + pci_passthrough => hiera('CONFIG_NOVA_PCI_PASSTHROUGH_WHITELIST'), } # Tune the host with a virtual hosts profile