Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望添加解除虚拟机 vCPU 限制功能 #80

Open
ghost opened this issue Jun 3, 2023 · 1 comment
Open

希望添加解除虚拟机 vCPU 限制功能 #80

ghost opened this issue Jun 3, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 3, 2023

应用场景

因特殊需求,有时候需要创建虚拟机,自定义核数。

案例

比如主机只有 4 个核,但是虚拟机要创建 8 个核,Proxmox 会报:MAX $allowed_vcpus vcpus allowed per VM on this node 错误。但 QEMU 实际上是允许这样操作的。

有什么用?

在一些不支持超线程的高频 CPU 上,比如 i5,这样操作可以提升部分虚拟机的性能。同时需要配合 cpulimit 参数。比如给虚拟机分配 8 个 vCPU,但是只占用主机 3 个核心的性能,vCPU 配置为 8,CPU Limit 配置为 3.0。

解决方法

  1. 编辑文件 /usr/share/perl5/PVE/QemuServer.pm
  2. 注释如下两行:
    # my $allowed_vcpus = $cpuinfo->{cpus};
    # die "MAX $allowed_vcpus vcpus allowed per VM on this node\n" if ($allowed_vcpus < $maxcpus);
  3. 重启 pvedaemon 服务
@leidian
Copy link

leidian commented Jan 13, 2024

我两行代码都注释掉之后pvedaemon服务无法启动。log报错“# my $allowed_vcpus = $cpuinfo->{cpus}; ”我将这行取消注释之后服务可以正常启动功能限制也可以解除。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant