![如何配置 Openstack 使其认为有 32 个 vcpu 可用而不是 16vCPU?](https://linux22.com/image/783520/%E5%A6%82%E4%BD%95%E9%85%8D%E7%BD%AE%20Openstack%20%E4%BD%BF%E5%85%B6%E8%AE%A4%E4%B8%BA%E6%9C%89%2032%20%E4%B8%AA%20vcpu%20%E5%8F%AF%E7%94%A8%E8%80%8C%E4%B8%8D%E6%98%AF%2016vCPU%EF%BC%9F.png)
OpenStack Xena CentOS 8 Stream
我的任务是将 vCPU 从 16 个增加到 32 个。我尝试过量使用,但不起作用。
我有一个控制器和一个计算。计算输出:
[root@controller ~(keystone)]# openstack hypervisor stats show
+----------------------+-------+
| field | value |
+----------------------+-------+
| count | 1 |
| current_workload | 0 |
| disk_available_least | 62 |
| free_disk_gb | 69 |
| free_ram_mb | 31326 |
| local_gb | 69 |
| local_gb_used | 0 |
| memory_mb | 31838 |
| memory_mb_used | 512 |
| running_vms | 0 |
| vcpus | 16 |
| vcpus_used | 0 |
+----------------------+-------+
默认情况下,在 /etc/nova/nova.conf 中计算:
# Virtual CPU to physical CPU allocation ratio. For more information, refer to
# the documentation. (floating point value)
# Minimum value: 0.0
#cpu_allocation_ratio=<None>
我这样做了:cpu_allocation_ratio=2.0
,然后systemctl restart openstack-nova-compute
。之后我openstack hypervisor stats show
再次执行此操作,发现仍有 16 个 vCPU 可用。
/etc/nova/nova.conf 还有一个选项:
#
# Initial virtual CPU to physical CPU allocation ratio. For more information,
# refer to the documentation. (floating point value)
# Minimum value: 0.0
#initial_cpu_allocation_ratio=16.0
我尝试设置initial_cpu_allocation_ratio=32.0
,但也没有帮助。
此外,我发现只有关于过度承诺的此类文档https://docs.openstack.org/arch-design/design-compute/design-compute-overcommit.html,但没有说明如何正确配置。
答案1
检查分配比例:
openstack resource provider inventory list 4f35070b-df79-41d1-88e0-831e5f210497
+----------------+------------------+----------+----------+----------+-----------+--------+--------+
| resource_class | allocation_ratio | min_unit | max_unit | reserved | step_size | total | used |
+----------------+------------------+----------+----------+----------+-----------+--------+--------+
| VCPU | 2.08 | 1 | 112 | 0 | 1 | 112 | 222 |
| MEMORY_MB | 1.18 | 1 | 515164 | 8192 | 1 | 515164 | 395264 |
| DISK_GB | 0.98 | 1 | 7150 | 0 | 1 | 7150 | 2985 |
+----------------+------------------+----------+----------+----------+-----------+--------+--------+
如果需要获取计算值:
openstack allocation candidate list --resource MEMORY_MB=1 -f json -c "inventory used/capacity" -c "resource provider"
[
{
"resource provider": "4f35070b-df79-41d1-88e0-831e5f210497",
"inventory used/capacity": "VCPU=222/232,MEMORY_MB=395264/598226,DISK_GB=2985/7007"
}
]