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的個數,及設置情況