This example demonstrates booting a VM with two NUMA nodes.
To boot VM with two NUMA nodes:
Create a new flavor or use an existing one to use with NUMA. To create a new flavor, run:
. openrc admin admin
nova flavor-create m1.numa 999 1024 5 4
Add numa_nodes to the flavor.
Note
vCPUs and RAM will be divided equally between the NUMA nodes.
nova flavor-key m1.numa set hw:numa_nodes=2
nova flavor-show m1.numa
Example of system response:
+----------------------------+------------------------+
| Property                   | Value                  |
+----------------------------+------------------------+
| OS-FLV-DISABLED:disabled   | False                  |
| OS-FLV-EXT-DATA:ephemeral  | 0                      |
| disk                       | 5                      |
| extra_specs                | {"hw:numa_nodes": "2"} |
| id                         | 999                    |
| name                       | m1.numa                |
| os-flavor-access:is_public | True                   |
| ram                        | 1024                   |
| rxtx_factor                | 1.0                    |
| swap                       |                        |
| vcpus                      | 4                      |
+----------------------------+------------------------+
Create a new image or use an existing image.
Note
You need an Ubuntu image and the default Cirros image.
To create a new Ubuntu image:
glance --os-image-api-version 1 image-create --name ubuntu \
       --location https://cloud-images.ubuntu.com/trusty/current/\
       trusty-server-cloudimg-amd64-disk1.img \
       --disk-format qcow2 --container-format bare
To enable SSH connections:
Add a new rule to the security group:
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
Create a new SSH key pair or use the existing key pair. To create a new ssh key pair:
ssh-keygen
Add the key pair to Nova:
nova keypair-add --pub_key ~/.ssh/id_rsa.pub my_kp
Verify free memory before you boot the VM:
numactl -H
Example of system response:
available: 2 nodes (0-1)
node 0 cpus: 0 1
node 0 size: 3856 MB
node 0 free: 718 MB
node 1 cpus: 2 3
node 1 size: 3937 MB
node 1 free: 337 MB
node distances:
node   0   1
  0:  10  20
  1:  20  10
Boot a new instance using the created flavor:
nova boot --flavor m1.numa --image ubuntu --key-name my_kp inst1
Verify if free memory has been changed after booting the VM:
numactl -H
Example of system response:
available: 2 nodes (0-1)
node 0 cpus: 0 1
node 0 size: 3856 MB
node 0 free: 293 MB           # was 718 MB
node 1 cpus: 2 3
node 1 size: 3937 MB
node 1 free: 81 MB            # was 337 MB
node distances:
node   0   1
  0:  10  20
  1:  20  10
Retrieve the instance’s IP:
nova show inst1 | awk '/network/ {print $5}'
Example of system response:
10.0.0.2
Connect to the VM using SSH:
ssh ubuntu@10.0.0.2
Install numactl:
sudo apt-get install numactl
Verify the NUMA topology on the VM:
numactl -H
Example of system response:
available: 2 nodes (0-1)
node 0 cpus: 0 1
node 0 size: 489 MB
node 0 free: 393 MB
node 1 cpus: 2 3
node 1 size: 503 MB
node 1 free: 323 MB
node distances:
node   0   1
  0:  10  20
  1:  20  10