Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gibizer/0981e1fb4cada4bef1856b94de7150c4 to your computer and use it in GitHub Desktop.
Save gibizer/0981e1fb4cada4bef1856b94de7150c4 to your computer and use it in GitHub Desktop.

Chapter 3. Configuring Compute nodes for performance

# (gibi): this chapter is good as is

3.1. Configuring CPU pinning on Compute nodes

# (gibi): mostly good. But the 3rd bullet point needs a reword as we don't have overcloud any more. I think we can even drop the 3rd bullet point

  1. Designate Compute nodes for CPU pinning.
  2. Configure the Compute nodes to reserve host cores for pinned instance vCPU processes, floating instance vCPU processes, and host processes.

3. Deploy the overcloud.

  1. Create a flavor for launching instances that require CPU pinning.
  2. Create a flavor for launching instances that use shared, or floating, CPUs.

3.1.2. Designating Compute nodes for CPU pinning

# (gibi): we can simplify a lot here

# (gibi): the note make sense but needs a bit of rewording

⚠️ Note The following procedure applies to new OpentStackDataPlaneNodeSet CRs that have not yet been provisioned. To reconfigure and OpentStackDataPlaneNodeSet that has already been provisioned, you must drain the guest VMS from all the nodes in the NodeSet first.

# (gibi): we can drop most of the original procedures here. We don't have a product specific way to do HW inspection so what I write below is generic linux procedure

  1. Gather the IP addresses of the compute nodes in the NodeSet you want to configure with CPU pinning. Collect the IP addresses from the OpenStackDataPlaneNodeSet you want to re-configure.

    $ oc get OpenStackDataPlaneNodeSet/openstack-edpm -o go-template --template '{{range $_, $node := .spec.nodes}} {{$node.ansible.ansibleHost}} {{end}}'
    "192.168.122.100"
    "192.168.122.101"
  2. Check the available PCPUs on these hosts

    $ IPS=$(oc get OpenStackDataPlaneNodeSet/openstack-edpm -o go-template --template '{{range $_, $node := .spec.nodes}} {{$node.ansible.ansibleHost}} {{end}}')
    $ for IP in $IPS; do echo $IP ; ssh root@$IP lscpu | grep -e 'NUMA node.* CPU(s):' ; done
    192.168.122.100
    NUMA node0 CPU(s):                  0-1,4-5
    192.168.122.101
    NUMA node0 CPU(s):                  2-3,6-7

3.1.3. Configuring Compute nodes for CPU pinning

# (gibi): the paragraph and table before procedure looks good as is.

Procedure

# (gibi): the original step 2. can be dropped, the NUMATopologyFilter already enabled by default in NG

  1. Create an ConfigMap with nova-compute configuration snippet to configure the Compute nodes to reserve cores for pinned instances, floating instances, and host processes. For example create the nova-compute-cpu-pinning.yaml:

    apiVersion: v1
    data:
      25-nova-extra.conf: |
        [compute]
        cpu_shared_set = 2,6
        cpu_dedicated_set = 1,3,5,7
        reserved_host_memory_mb = <ram>
     
    kind: ConfigMap
    metadata:
      name: nova-compute-cpu-pinning
      namespace: openstack
    

    You can use cpu_dedicated_set to reserve physical CPU cores for the dedicated instances. You can use cpu_shared_set to reserve physical CPU cores for the shared instances. You can use reserved_host_memory_mb to specify the amount of RAM to reserve for host processes. Replace <ram> with the amount of RAM to reserve in MB.

    Create the ConfigMap from nova-compute-cpu-pinning.yaml

    $ oc apply -f nova-compute-cpu-pinning.yaml
    configmap/nova-compute-cpu-pinning created
  2. Define OpenStackDataPlaneService/nova-custom based on the default OpenStackDataPlaneService/nova to be able to include the new ConfigMap. The default OpenStackDataPlaneService/nova cannot be modified (if modified the system will override the user modification). For example create dataplaneservice_nova-custom.yaml:

    apiVersion: dataplane.openstack.org/v1beta1
    kind: OpenStackDataPlaneService
      name: nova-custom
      namespace: openstack
    spec:
      label: dataplane-deployment-nova
      playbook: osp.edpm.nova
      secrets:
      - nova-cell1-compute-config
      configMaps:
      - nova-compute-cpu-pinning
    

    Create the OpenStackDataPlaneService/nova-custom service:

    $ oc apply -f dataplaneservice_nova-custom.yaml
    openstackdataplaneservice.dataplane.openstack.org/nova-custom created
  3. Modify the OpenStackDataPlaneNodeSet to use the newly created nova-custom service instead of the default nova service. If the current state is:

    $ oc get OpenStackDataPlaneNodeSet/openstack-edpm -o go-template --template '{{range $service := .spec.services}}{{println $service}}{{end}}'
    repo-setup
    download-cache
    configure-network
    validate-network
    install-os
    configure-os
    run-os
    ovn
    neutron-metadata
    libvirt
    nova
    telemetry

    then use oc edit OpenStackDataPlaneNodeSet/openstack-edpm and change the definition to look like this:

    $ oc get OpenStackDataPlaneNodeSet/openstack-edpm -o go-template --template '{{range $service := .spec.services}}{{println $service}}{{end}}'
    repo-setup
    download-cache
    configure-network
    validate-network
    install-os
    configure-os
    run-os
    ovn
    neutron-metadata
    libvirt
    nova-custom
    telemetry
  4. Optionally to ensure that host processes do not run on the CPU cores reserved for instances, set the ansible variable edpm_tuned_isolated_cores in the OpenStackDataPlaneNodeSet to the CPU cores you have reserved for instances

    $ oc patch -o yaml OpenStackDataPlaneNodeSet/openstack-edpm \
      -p='[{"op": "replace", "path": "/spec/nodeTemplate/ansible/ansibleVars/edpm_tuned_profile", "value":"cpu-partitioning"}]' \
      --type json
    $ oc patch -o yaml OpenStackDataPlaneNodeSet/openstack-edpm \
      -p='[{"op": "replace", "path":"/spec/nodeTemplate/ansible/ansibleVars/edpm_tuned_isolated_cores", "value":"1-3,5-7"}]' \
      --type json

    ⚠️ Note: If this configuration is applied then compute nodes in the NodeSet needs to be rebooted after the deployment succeeded. This reboot is not automated today.

  5. Define a new OpenStackDataPlaneDeployment referring to the modified OpenStackDataPlaneNodeSet. For example create deployment.yaml:

    apiVersion: dataplane.openstack.org/v1beta1
    kind: OpenStackDataPlaneDeployment
    metadata:
      name: openstack-edpm-2
      namespace: openstack
    spec:
      nodeSets:
      - openstack-edpm
    
  6. Execut the deployment

    $ oc apply -f deployment.yaml

# (gibi): the rest of 3.1.x looks good as is but drop the reference to the "overcloud"

@igallagh-redhat
Copy link

Fantastic, thank you @gibizer !!

@SeanMooney
Copy link

the only really issue i have with this version is the references to reserved_host_memory_mb

we should either also reference the other parameters like
https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.reserved_huge_pages
https://docs.openstack.org/nova/latest/configuration/config.html#DEFAULT.reserved_host_disk_mb
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.file_backed_memory
or we should just removed reserved_host_memory_mb and cover that in a separate document.
that's not really related to configuring CPU pinning that related to configuring host resource reservation.

as general feedback on the stucruture.
rather then just covering CPU pinning n 3.1 we could also include the other CPU related options like
cpu_mode=host_passthoug|host_model|custome
cpu_models=...
cpu_models_extra_flags
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_mode
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_models
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_model_extra_flags

we could also include nova CPU govnoner/onlien state management here in 3.1
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_power_management
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_power_management_strategy
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_power_governor_low
https://docs.openstack.org/nova/latest/configuration/config.html#libvirt.cpu_power_governor_high

i would keep subchapter 3.1 strictly scoped to CPU configuration.
maek 3.2 everything to do with memory
3.3 everything related to disk configuration.
then add more chapperts as apprparoty

i think that would be a more natural grouping rather then arbitarlly selecting CPU pining in its own chapter without the other elated CPU features.

chapter 3.2 (memory) could cover host memory reservation, hugepages, file backed memory and swap.

3.3 disk configuration could cover image formats, image backends (qcow/rbd/flat/raw), disk reservation, cache modes,

3.4 could cover everything device passsthoug related (PCI passhtough/sriov, mdevs/vgpu)

@SeanMooney
Copy link

we have tried to documetn much fo the CPU topic upstream in
https://docs.openstack.org/nova/latest/admin/cpu-topologies.html and
https://docs.openstack.org/nova/latest/admin/cpu-models.html

although those don't fully cover all CPU related topics in just those doc but its is most of them.

if we want to provide better docs then upstream i think this grouping would help operators better understand nova if we cover CPU, RAM and DISK holistically in 3 chapters and then go on to the more advanced topics later for functionality not directly related to CPU ram and disk like device passhtough, vtpm, sev, uefi ectra.

@gibizer
Copy link
Author

gibizer commented Oct 24, 2023

@SeanMooney I agree with your sentiment here. However I suggest to do such doc improvement as a separate step. Similarly how we tend not to commit refactoring and new features into the same commit, I would like to keep the pure translation of the doc from tripleo to NG separate from the new documentation structuring. I think it make sense to file Jira(s) for your doc improvements. Those Jiras would be perfect to outline the new structure by providing an expected table of content. Also Jiras would allow us (both dev and doc) to plan the actual work.

@igallagh-redhat
Copy link

@gibizer WRT the rewritten note:

"The following procedure applies to new OpenStackDataPlaneNodeSet CRs that have not yet been provisioned. To reconfigure an existing OpenStackDataPlaneNodeSet that has already been provisioned, you must first drain the guest instances from all the nodes in the OpenStackDataPlaneNodeSet."

How likely is it that an admin would re-purpose an existing OpenStackDataPlaneNodeSet CR for this feature?

Would this note be better placed in the "Creating the data plane" chapter in the core install and deployment doc instead? Maybe in https://docs.google.com/document/d/1uEpLEF7fhH_ZvdTAwC6QSk3eax4HDRXgscX2EV5kAjM/edit#bookmark=id.50q542e1n3lt or https://docs.google.com/document/d/1uEpLEF7fhH_ZvdTAwC6QSk3eax4HDRXgscX2EV5kAjM/edit#bookmark=id.nuelvc6sqw8y?

@igallagh-redhat
Copy link

@gibizer Does the 25-nova-extra.conf file already exist? If not, and we are creating it, are there rules around how to construct the filename?

@igallagh-redhat
Copy link

@gibizer can a NodeSet only run one nova service? I.e. does the admin have to replace the nova service with the new custom cpu-pinning service, or can they add it in additional to the nova service?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment