此内容没有您所选择的语言版本。
Chapter 10. Configuring Quality of Service (QoS) policies
With Red Hat OpenStack Platform network quality-of-service (QoS) policies, an OpenStack administrator can offer varying service levels by applying rate limits to egress traffic for instances. As a result of implementing a QoS policy, any traffic that exceeds the specified rate is consequently dropped.
10.1. QoS policy scope 复制链接链接已复制到粘贴板!
You can apply QoS policies to individual ports, or to a particular tenant network, where ports with no specific policy attached inherit the policy.
10.2. Creating and applying a QoS policy and rule 复制链接链接已复制到粘贴板!
To create a quality of service (QoS) policy and rule and apply the policy to a port, complete the following steps:
If the
qosextension is not already enabled for OpenStack Networking in /etc/neutron/plugins/ml2/<agent_name>_agent.ini, then follow these steps:Create a custom Heat environment file, and add the following lines:
parameter_defaults: NeutronSriovAgentExtensions: 'qos'
parameter_defaults: NeutronSriovAgentExtensions: 'qos'Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantYAML files are extremely sensitive about where in the file a parameter is placed. Make sure that
parameter_defaults:starts in the first column (no leading whitespace characters), and your parameter value pair starts in column three (the parameter has two whitespace characters in front of it).Run the Red Hat OpenStack Platform director command,
openstack overcloud deployand include all your current environment files and this custom new one.For more information, see "Modifying the overcloud environment" in the Director Installation and Usage guide.
Review the list of tenants and determine the id of where you need to create QoS policy:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a QoS policy named
bw-limiterin theadmintenant:openstack network qos policy create --project 98a2f53c20ce4d50a40dac4a38016c69 bw-limiter
# openstack network qos policy create --project 98a2f53c20ce4d50a40dac4a38016c69 bw-limiterCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the policing rules for the
bw-limiterpolicy:openstack network qos rule create --type bandwidth-limit --max-kbps 3000 --max-burst-kbits 30000 bw-limiter
# openstack network qos rule create --type bandwidth-limit --max-kbps 3000 --max-burst-kbits 30000 bw-limiterCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure a neutron port to apply the
bw-limiterpolicy:openstack port set --qos-policy bw-limiter port_name_or_id
# openstack port set --qos-policy bw-limiter port_name_or_idCopy to Clipboard Copied! Toggle word wrap Toggle overflow Review the QoS rule. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
These values allow you to configure the policing algorithm accordingly:
-
max_kbps- the maximum rate (in Kbps) that the instance is allowed to send. -
max_burst_kbps- the maximum amount of data (in kbits) that the port could send in a instant if the token buffer was full. The token buffer is replenished at a "max_kbps" rate.
10.3. DSCP marking for egress traffic 复制链接链接已复制到粘贴板!
You can use differentiated services code point (DSCP) to implement quality-of-service (QoS) policies on your network by embedding relevant values in the IP headers. The Networking service (neutron) QoS policies can use DSCP marking to manage egress traffic on neutron ports and networks.
Procedure
If you are:
- using ML2/OVN, skip to step 2.
- using ML2/OVS without a tunneling protocol, skip to step 2.
using ML2/OVS with a tunneling protocol (VXLAN and GRE), then perform the following steps:
Log in to the undercloud host as the
stackuser.source ~/stackrc
$ source ~/stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a custom YAML environment file.
Example
vi /home/stack/templates/my-neutron-environment.yaml
$ vi /home/stack/templates/my-neutron-environment.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow In the YAML environment file under
parameter_defaults, add the following lines:parameter_defaults: ControllerExtraConfig: neutron::config::server_config: agent/dscp_inherit: value: trueparameter_defaults: ControllerExtraConfig: neutron::config::server_config: agent/dscp_inherit: value: trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow When
dscp_inheritistrue, the Networking service copies the DSCP value of the inner header to the outer header.Run the deployment command and include the core heat templates, environment files, and this new custom environment file.
ImportantThe order of the environment files is important as the parameters and resources defined in subsequent environment files take precedence.
Example
openstack overcloud deploy --templates \ -e [your-environment-files] \ -e /usr/share/openstack-tripleo-heat-templates/environments/services/ \ neutron-ovs.yaml \ -e /home/stack/templates/my-neutron-environment.yaml
$ openstack overcloud deploy --templates \ -e [your-environment-files] \ -e /usr/share/openstack-tripleo-heat-templates/environments/services/ \ neutron-ovs.yaml \ -e /home/stack/templates/my-neutron-environment.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Source your credentials file.
Example
source ~/overcloudrc
$ source ~/overcloudrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new QoS policy:
Example
openstack network qos policy create --project 98a2f53c20ce4d50a40dac4a38016c69 qos-web-servers
openstack network qos policy create --project 98a2f53c20ce4d50a40dac4a38016c69 qos-web-serversCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a DSCP rule and apply it to a policy.
Example
In this example, a DSCP rule is created using DSCP mark
18and is applied to theqos-web-serverspolicy:openstack network qos rule create --type dscp-marking --dscp-mark 18 qos-web-servers
openstack network qos rule create --type dscp-marking --dscp-mark 18 qos-web-serversCopy to Clipboard Copied! Toggle word wrap Toggle overflow Sample output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can change the DSCP value assigned to a rule.
Example
openstack network qos rule set --dscp-mark 22 qos-web-servers d7f976ec-7fab-4e60-af70-f59bf88198e6
openstack network qos rule set --dscp-mark 22 qos-web-servers d7f976ec-7fab-4e60-af70-f59bf88198e6Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can delete a DSCP rule.
Example
openstack network qos rule delete qos-web-servers d7f976ec-7fab-4e60-af70-f59bf88198e6
openstack network qos rule delete qos-web-servers d7f976ec-7fab-4e60-af70-f59bf88198e6Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Confirm that the DSCP rule (d7f976ec-7fab-4e60-af70-f59bf88198e6) is applied to the QoS policy (qos-web-servers).
Example
openstack network qos rule list qos-web-servers
openstack network qos rule list qos-web-serversCopy to Clipboard Copied! Toggle word wrap Toggle overflow Sample output
+-----------+--------------------------------------+ | dscp_mark | id | +-----------+--------------------------------------+ | 18 | d7f976ec-7fab-4e60-af70-f59bf88198e6 | +-----------+--------------------------------------+
+-----------+--------------------------------------+ | dscp_mark | id | +-----------+--------------------------------------+ | 18 | d7f976ec-7fab-4e60-af70-f59bf88198e6 | +-----------+--------------------------------------+Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.4. RBAC for QoS Policies 复制链接链接已复制到粘贴板!
You can add a role-based access control (RBAC) for quality-of-service (QoS) policies. As a result, you can now make QoS policies available to certain projects.
For example, you can now create a QoS policy that allows for lower-priority network traffic, and have it only apply to certain projects. Run the following command to assign the bw-limiter policy to the project, demo:
openstack network rbac create --type qos_policy --target-project 80bf5732752a41128e612fe615c886c6 --action access_as_shared rbac_name
# openstack network rbac create --type qos_policy --target-project 80bf5732752a41128e612fe615c886c6 --action access_as_shared rbac_name