openstack numa详解(命令使用篇)

openstack中,对虚机内部的cpu numa node的拓扑即vnuma node进行构造的方式

方式一:

通过flavor的方式进行配置:

$ openstack flavor set FLAVOR-NAME \
    --property hw:numa_nodes=FLAVOR-NODES \
    --property hw:numa_cpus.N=FLAVOR-CORES \
    --property hw:numa_mem.N=FLAVOR-MEMORY
FLAVOR-NODES 表示虚机内部有几个node ,numa_cpus.N 表示虚机内部vnuma node的索引号,numa_mem.N 表示虚机内部vnuma node的内存大小
样例:
 [root@test ~]# nova flavor-show 4c_3g_2g
+----------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Property                   | Value                                                                                                                      |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------+
| OS-FLV-DISABLED:disabled   | False                                                                                                                      |
| OS-FLV-EXT-DATA:ephemeral  | 0                                                                                                                          |
| description                | -                                                                                                                          |
| disk                       | 2                                                                                                                          |
| extra_specs                | {"hw:numa_nodes": "2", "hw:numa_cpus.0": "0,1", "hw:numa_mem.0": "1024", "hw:numa_cpus.1": "2,3", "hw:numa_mem.1": "2048"} |
| id                         | 1f502bd9-3715-4a53-a177-ee77858cb4a7                                                                                       |
| name                       | 4c_3g_2g                                                                                                                   |
| os-flavor-access:is_public | True                                                                                                                       |
| ram                        | 3072                                                                                                                       |
| rxtx_factor                | 1.0                                                                                                                        |
| swap                       | 0                                                                                                                          |
| vcpus                      | 4                                                                                                                          |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------+
(u_dianxin) [root@hyserver01 ~]# 

  

方式二:

通过image的方式进行配置,flavor里面,只设置cpu个数,内存大小及根磁盘空间

glance image-update 25bb9cd6-186c-4336-ada7-923430ea5de4 \
--property hw_numa_nodes=2 \
--property hw_numa_cpus.0=0 \
--property hw_numa_cpus.1=1 \
--property hw_numa_mem.0=1024 \
--property hw_numa_mem.1=1024 

样例1:

[root@test ~]# glance image-show 25bb9cd6-186c-4336-ada7-923430ea5de4
+------------------+----------------------------------------------------------------------------------+
| Property         | Value                                                                            |
+------------------+----------------------------------------------------------------------------------+
| checksum         | 443b7623e27ecf03dc9e01ee93f67afe                                                 |
| container_format | bare                                                                             |
| created_at       | 2021-09-01T02:07:36Z                                                             |
| disk_format      | qcow2                                                                            |
| hw_numa_cpus.0   | 0                                                                                |
| hw_numa_cpus.1   | 1                                                                                |
| hw_numa_mem.0    | 1024                                                                             |
| hw_numa_mem.1    | 1024                                                                             |
| hw_numa_nodes    | 2                                                                                |
| id               | 25bb9cd6-186c-4336-ada7-923430ea5de4                                             |
| min_disk         | 0                                                                                |
| min_ram          | 0                                                                                |
| name             | cirros_hw                                                                        |
| os_hash_algo     | sha512                                                                           |
| os_hash_value    | 6513f21e44aa3da349f248188a44bc304a3653a04122d8fb4535423c8e1d14cd6a153f735bb0982e |
|                  | 2161b5b5186106570c17a9e58b64dd39390617cd5a350f78                                 |
| os_hidden        | False                                                                            |
| owner            | 97ce954e6b7c4a59b5bf06b48aadb73a                                                 |
| protected        | False                                                                            |
| size             | 12716032                                                                         |
| status           | active                                                                           |
| stores           | file                                                                             |
| tags             | []                                                                               |
| updated_at       | 2021-09-01T02:20:31Z                                                             |
| virtual_size     | Not available                                                                    |
| visibility       | shared                                                                           |
+------------------+----------------------------------------------------------------------------------+

 

如果只是设置hw_numa_nodes参数,其他的参数不设置,那么nova代码,会自动根据flavor里面cpu,memory的大小,自动进行平分。

通过这两种方式,创建完虚机以后,可以进入到虚机内部,通过lscpu命令,查看到numa node的个数,及设置情况

 

 

 

  

 

posted @ 2021-09-06 13:36  一切都是当下  阅读(1023)  评论(0编辑  收藏  举报