如何使用带有两个 CPU 的 VirtualBox 在 Vagrant 中创建 VM? [英] How can I create a VM in Vagrant with VirtualBox with two CPUs?

查看:35
本文介绍了如何使用带有两个 CPU 的 VirtualBox 在 Vagrant 中创建 VM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 64 位 Windows 7 上尝试启动 VM(Ubuntu 32 位).尽管在 Vagrantfile 中添加了 modify vm 命令,但我还是无法让我的 VM 显示两个内核.我的 Vagrant 版本是 1.2.2.

On Windows 7 64 bit trying to start up a VM (Ubuntu 32 bit). I'm having trouble getting my VM to show two cores despite adding the modify vm command in my Vagrantfile. My Vagrant version is 1.2.2.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "precise32"
  config.vm.box_url = "http://files.vagrantup.com/precise32.box"

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
    vb.customize ["modifyvm", :id, "--cpus", "2"]   
  end  
end

使用这个 Vagrantfile 我发出 vagrant up 命令.然后我发出 vagrant ssh 后跟 lscpu 产生:

With this Vagrantfile I issue the vagrant up command. Then I issue vagrant ssh followed by lscpu which yields:

Architecture:          i686
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Stepping:              9
CPU MHz:               2565.513
BogoMIPS:              5131.02
L1d cache:             32K
L1d cache:             32K
L2d cache:             6144K

我认为 CPU 应该显示 2,所以我的 VM 现在只有一个 CPU.我如何在运行 lscpu 时显示 2 个 CPU?

I think CPU(s) should show 2, so my VM only has one CPU right now. How can I get 2 CPUs to show up when I run lscpu?

推荐答案

vb.customize ["modifyvm", :id, "--ioapic", "on"] 添加到 >config.vm.provider 块在你的 Vagrantfile 中.

Add vb.customize ["modifyvm", :id, "--ioapic", "on"] to the config.vm.provider block inside your Vagrantfile.

查看 VirtualBox 文档,它提到:

Looking at the VirtualBox documentation it mentions:

"注意 64 位来宾操作需要启用 I/O APIC系统,尤其是 Windows Vista;如果你想,它也是必需的在一台虚拟机中使用多个虚拟 CPU."

"Note Enabling the I/O APIC is required for 64-bit guest operating systems, especially Windows Vista; it is also required if you want to use more than one virtual CPU in a virtual machine."

这篇关于如何使用带有两个 CPU 的 VirtualBox 在 Vagrant 中创建 VM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆