Testing NUMA related hardware setup with libvirt and DevStack ============================================================= Reference: https://review.openstack.org/#/c/131818/1/doc/source/devref/testing/libvirt-numa.rst Ensure to enable services: $ sudo systemctl enable postgresql $ sudo systemctl enable rabbitmq-server $ sudo systemctl enable httpd $ sudo systemctl enable openvswitch Test env -------- libvirt git (Running on DevStack VM): $ git describe CVE-2014-7823-193-g6085d91 $ git rev-parse --short HEAD 6085d91 Nova: nova]$ git describe 2014.2-995-g5d2ea10 nova]$ git rev-parse --short HEAD 5d2ea10 DevStack: $ git log | head -5 commit 3b1647310d8b8b975e74d2601ba841e373b97b20 Merge: ca7aa30 ea70cc9 Author: Jenkins Date: Wed Nov 26 15:42:29 2014 +0000 Testing basic non-NUMA usage ---------------------------- Boot a Nova guest and check the NUMA topology in the database: $ nova boot --image cirros-0.3.1-x86_64-disk --flavor m1.tiny cirrvm1 $ sudo -u postgres psql nova=# nova=# SELECT numa_topology FROM compute_nodes; numa_topology ------------------------------------------------------------------------------------------------------ {"cells": [{"mem": {"total": 7794, "used": 0}, "cpu_usage": 0, "cpus": "0,1,2,3,4,5,6,7", "id": 0}]} (1 row) nova=# SELECT numa_topology FROM instance_extra; numa_topology --------------- (1 row) nova=# Reconfiguring the DevStack instance to have NUMA topology --------------------------------------------------------- Ensure the DevStack VM's config has: $ virsh dumpxml fedvm1 | grep cpu 8 And the below in nova.conf: . . . [DEFAULT] scheduler_default_filters=RetryFilter, AvailabilityZoneFilter, RamFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter, NUMATopologyFilter [libvirt] virt_type = kvm . . . Re-join the stack.sh: $ ./rejoin.sh (Optionally, ensure all the services have started successfully by validating all the `screen` windows for OpenStack services.) $ sudo -u postgres psql nova nova=# select numa_topology from compute_nodes; numa_topology ------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------- {"cells": [{"mem": {"total": 3857, "used": 0}, "cpu_usage": 0, "cpus": "0,1,2,3", "id": 0}, {"mem": {"total": 1969, "used": 0}, "cpu_usage": 0, "cpus ": "4,5", "id": 1}, {"mem": {"total": 1967, "used": 0}, "cpu_usage": 0, "cpus": "6,7", "id": 2}]} (1 row) nova=# The above indeed shows that there are now 3 NUMA nodes for the “host” (DevStack, i.e.) machine, the first with 4 GB of RAM and 4 CPUs, and others with 2 GB of RAM and 2 CPUs each. Testing instance boot with no NUMA topology requested ----------------------------------------------------- $ nova flavor-create m1.numa 999 1024 1 4 $ nova flavor-key m1.numa set hw:numa_nodes=1 $ nova flavor-show m1.numa +----------------------------+------------------------+ | Property | Value | +----------------------------+------------------------+ | OS-FLV-DISABLED:disabled | False | | OS-FLV-EXT-DATA:ephemeral | 0 | | disk | 1 | | extra_specs | {"hw:numa_nodes": "1"} | | id | 999 | | name | m1.numa | | os-flavor-access:is_public | True | | ram | 1024 | | rxtx_factor | 1.0 | | swap | | | vcpus | 4 | +----------------------------+------------------------+ Boot an instance using the new NUMA flavor just created: $ nova boot --image cirros-0.3.1-x86_64-disk --flavor m1.numa cirrvm2 Testing instance boot with 1 NUMA cell requested ------------------------------------------------ Works with libvirt RPMs built from git: $ git describe CVE-2014-7823-193-g6085d91 $ git rev-parse --short HEAD 6085d91 which has the commit mentioned in comment #7. Re-testing Nova with these RPMs (libvirt-1.2.11 -- yet to be released) version, Nova instance with NUMA topology boots successfully: 1. Create a Nova flavor with NUMA topology: $ nova flavor-create m1.numa 999 1024 1 4 $ nova flavor-key m1.numa set hw:numa_nodes=1 $ nova flavor-show m1.numa +----------------------------+------------------------+ | Property | Value | +----------------------------+------------------------+ | OS-FLV-DISABLED:disabled | False | | OS-FLV-EXT-DATA:ephemeral | 0 | | disk | 1 | | extra_specs | {"hw:numa_nodes": "1"} | | id | 999 | | name | m1.numa | | os-flavor-access:is_public | True | | ram | 1024 | | rxtx_factor | 1.0 | | swap | | | vcpus | 4 | +----------------------------+------------------------+ 2. Boot a Nova guest: $ nova boot --image cirros-0.3.1-x86_64-disk --flavor m1.numa cirrvm5 3. Find the Nova instance: $ nova list | grep cirrvm5 | 5d4c50ff-301c-44cb-826f-ffa07266d85f | cirrvm5 | ACTIVE | - | Running | public=172.24.4.6 | 4. Find the libvirt ID for the Nova instance: $ grep -i 5d4c50ff-301c-44cb-826f-ffa07266d85f /etc/libvirt/qemu/*.xml | grep uuid /etc/libvirt/qemu/instance-00000004.xml: 5d4c50ff-301c-44cb-826f-ffa07266d85f [. . .] 5. Nova instance's libvirt XML: --------------------------- $ sudo virsh dumpxml instance-00000004 instance-00000004 5d4c50ff-301c-44cb-826f-ffa07266d85f cirrvm5 2014-11-28 18:11:27 1024 1 0 0 4 admin admin 1048576 1048576 4 /machine OpenStack Foundation OpenStack Nova 2015.1 bf6b5391-2390-df4f-b3dc-aa80d05468bb 5d4c50ff-301c-44cb-826f-ffa07266d85f hvm destroy restart destroy /usr/bin/qemu-kvm
system_u:object_r:svirt_image_t:s0:c176,c615 -------------------- 6. Check what Nova recorded in the database (PostgreSQL in this case): $ sudo -u postgres psql nova nova=# nova=# SELECT numa_topology FROM instance_extra; . . . {"nova_object.version": "1.1", "nova_object.changes": ["instance_uuid"], "nova_object.name": "InstanceNUMATopology", "nova_object.data": {"instance_u uid": "5d4c50ff-301c-44cb-826f-ffa07266d85f", "cells": [{"nova_object.version": "1.1", "nova_object.changes": ["cpuset", "id", "pagesize", "memory"], "nova_object.name": "InstanceNUMACell", "nova_object.data": {"cpuset": [0, 1, 2, 3], "id": 0, "pagesize": null, "memory": 1024}, "nova_object.namespac e": "nova"}]}, "nova_object.namespace": "nova"} nova=# select numa_topology from compute_nodes; numa_topology ------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------------------------------------------------- {"cells": [{"mem": {"total": 3857, "used": 1024}, "cpu_usage": 4, "cpus": "0,1,2,3", "id": 0}, {"mem": {"total": 1969, "used": 0}, "cpu_usage": 0, "c pus": "4,5", "id": 1}, {"mem": {"total": 1967, "used": 0}, "cpu_usage": 0, "cpus": "6,7", "id": 2}]} (1 row) nova=#