Changing parameters in OpenStack configuration files

You can modify the following parameters in the OpenStack configuration files:

Parameter Configuration file Description Value
scheduler_host_subset_size /etc/kolla/nova-scheduler/nova.conf Defines a number of compute nodes best suited for a new VM, one of which is randomly chosen by the scheduler. Valid values are 1 or greater. Any value less than 1 is treated as 1. The higher the value, the less optimal the chosen node may be for a VM. The default value is 1.
vxlan_udp_port /etc/kolla/neutron-openvswitch-agent/ml2_conf.ini Specifies the UDP port used for VXLAN tunnels. When changing the port, iptables rules are automatically configured for both the old and new ports. The default port is 4789.
cpu_allocation_ratio /etc/kolla/nova-compute/nova.conf

Defines the virtual CPU to physical CPU allocation ratio.

Changing CPU allocation ratio will not affect virtual CPUs already provisioned for virtual machines.

Valid values are positive integer or float. The default value is 8.0.
ram_allocation_ratio /etc/kolla/nova-compute/nova.conf

Defines the maximum reserved RAM to physical RAM allocation ratio.

Changing RAM allocation ratio will not affect RAM already provisioned for virtual machines.

Valid values are positive integer or float. The default value is 1.0. The maximum recommended value is 1.5.

To change a compute parameter

Use the following command:

vinfra service compute set [--custom-param <service_name> <config_file> <section> <property> <value>]
                           [--nova-compute-ram-allocation-ratio <value>]
                           [--neutron-openvswitch-vxlan-port <value>]
                           [--nova-scheduler-host-subset-size <value>]
                           [--nova-compute-cpu-allocation-ratio <value>]
--custom-param <service_name> <config_file> <section> <property> <value>

Set custom parameters for OpenStack configuration files:

  • service_name is the service name: nova-compute or neutron-openvswitch-agent
  • config_file specifies the service configuration file: nova.conf for nova-compute or ml2_conf.ini for neutron-openvswitch-agent
  • section specifies the section in the service configuration file where the parameter is defined: DEFAULT in nova.conf or agent in ml2_conf.ini
  • property is the parameter to be changed: ram_allocation_ratio, scheduler_host_subset, and cpu_allocation_ratio in nova.conf; vxlan_udp_port in ml2_conf.ini
  • value is a new parameter value
--nova-compute-ram-allocation-ratio <value>
Shortcut for --custom-param nova-compute nova.conf DEFAULT ram_allocation_ratio <value>
--neutron-openvswitch-vxlan-port <value>
Shortcut for --custom-param neutron-openvswitch-agent ml2_conf.ini agent vxlan_udp_port <value>
--nova-scheduler-host-subset-size <value>
Shortcut for --custom-param nova-scheduler nova.conf DEFAULT scheduler_host_subset_size <value>
--nova-compute-cpu-allocation-ratio <value>
Shortcut for --custom-param nova-scheduler nova.conf DEFAULT cpu_allocation_ratio <value>

For example, to change cpu_allocation_ratio and vxlan_udp_port, run:

# vinfra service compute set --nova-compute-cpu-allocation-ratio 16.0 --neutron-openvswitch-vxlan-port 4787

To check that the custom parameters are successfully modified, run:

# vinfra service compute show
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| <...>        | <...>                                     |
| options      | cpu_model: ''                             |
|              | custom_params:                            |
|              | - config_file: nova.conf                  |
|              |   property: cpu_allocation_ratio          |
|              |   section: DEFAULT                        |
|              |   service_name: nova-compute              |
|              |   value: 16.0                             |
|              | - config_file: ml2_conf.ini               |
|              |   property: vxlan_udp_port                |
|              |   section: agent                          |
|              |   service_name: neutron-openvswitch-agent |
|              |   value: 4787                             |
|              | notification_forwarding: disabled         |
| status       | active                                    |
+--------------+-------------------------------------------+

The applied changes are consistent on all compute nodes and not overwritten after product updates and upgrades.

If you want to change the vCPU or RAM allocation ratio on a particular compute node, use this command with the --nodes option. For example, to set cpu_allocation_ratio to 16 on the node node001, run:

# vinfra service compute set --nova-compute-cpu-allocation-ratio 16.0 --nodes node001