创建 vagrant VM libvirt 提供程序时出现不支持的配置错误
Unsupported configuration error when creating vagrant VM libvirt provider
我正在为 arm64 平台的 libvirt 提供程序创建一个 Ubuntu 20.04 服务器 vagrant base box。我已经从 qcow2 图像文件创建了一个基本框。
当尝试使用 vagrant up
命令创建 vagrant box 时,我在输出末尾收到错误:
Bringing machine 'ubuntu-vm' up with 'libvirt' provider...
==> ubuntu-vm: Creating image (snapshot of base box volume).
==> ubuntu-vm: Creating domain with the following settings...
==> ubuntu-vm: -- Name: vagrant-vm_ubuntu-vm
==> ubuntu-vm: -- Domain type: kvm
==> ubuntu-vm: -- Cpus: 1
==> ubuntu-vm: -- Memory: 512M
==> ubuntu-vm: -- Management MAC:
==> ubuntu-vm: -- Loader:
==> ubuntu-vm: -- Nvram:
==> ubuntu-vm: -- Base box: ubuntu20.04-arm64
==> ubuntu-vm: -- Storage pool: default
==> ubuntu-vm: -- Image: /var/lib/libvirt/images/vagrant-vm_ubuntu-vm.img (10G)
==> ubuntu-vm: -- Volume Cache: default
==> ubuntu-vm: -- Kernel:
==> ubuntu-vm: -- Initrd:
==> ubuntu-vm: -- Graphics Type: vnc
==> ubuntu-vm: -- Graphics Port: -1
==> ubuntu-vm: -- Graphics IP: 127.0.0.1
==> ubuntu-vm: -- Graphics Password: Not defined
==> ubuntu-vm: -- Video Type: cirrus
==> ubuntu-vm: -- Video VRAM: 9216
==> ubuntu-vm: -- Sound Type:
==> ubuntu-vm: -- Keymap: en-us
==> ubuntu-vm: -- TPM Path:
==> ubuntu-vm: -- INPUT: type=mouse, bus=ps2
==> ubuntu-vm: Creating shared folders metadata...
==> ubuntu-vm: Starting domain.
There was an error talking to Libvirt. The error message is shown below:
Call to virDomainCreateWithFlags failed: unsupported configuration: CPU mode 'host-model' for aarch64 kvm domain on aarch64 host is not supported by hypervisor
我的 Vagrantfile 是:
UbuARM = "ubuntu20.04-arm64"
Vagrant.configure("2") do |config|
config.vm.define "ubuntu-vm" do |nodeconfig|
nodeconfig.vm.box = UbuARM
nodeconfig.vm.hostname = "ubuntu-vm"
nodeconfig.vm.network :public_network,
bridge: "br0",
dev: "br0",
mode: "bridge",
type: "bridge"
nodeconfig.vm.provider :libvirt do |libvirt|
libvirt.uri="qemu:///system"
libvirt.storage_pool_name = "default"
libvirt.storage_pool_path = "/var/lib/libvirt/images"
libvirt.features = [] # had to put this to solve some error
end
end
end
在大多数情况下,qemu for ARM64 不支持 vagrant 的默认选项。
在这种情况下,cpu_mode 的默认值为 'host-model',体系结构不支持它。您可以使用 'host-passthrough'.
提示:对于任何试图在 ARM64 中使用 vagrant-libvirt 进行虚拟化的人,我建议转储 libvirt XML 域定义并使用 vagrant-libvirt 插件选项复制它。
这些选项对我很有用:
libvirt.features = ["apic", "gic version='2'"]
libvirt.machine_type = "virt-5.2"
libvirt.machine_arch = "aarch64"
libvirt.loader = "/usr/share/AAVMF/AAVMF_CODE.fd"
libvirt.cpu_mode = "host-passthrough"
libvirt.input :type => "mouse", :bus => "usb"
libvirt.input :type => "keyboard", :bus => "usb"
libvirt.usb_controller :model => "qemu-xhci"
libvirt.video_type = "vga"
libvirt.channel :type => 'unix', :target_type => 'virtio', :target_name => 'org.qemu.guest_agent.0', :target_port => '1', :source_path => '/var/lib/libvirt/qemu/channel/target/domain-1-ubuntu20.04/org.qemu.guest_agent.0', :source_mode => 'bind'
我正在为 arm64 平台的 libvirt 提供程序创建一个 Ubuntu 20.04 服务器 vagrant base box。我已经从 qcow2 图像文件创建了一个基本框。
当尝试使用 vagrant up
命令创建 vagrant box 时,我在输出末尾收到错误:
Bringing machine 'ubuntu-vm' up with 'libvirt' provider...
==> ubuntu-vm: Creating image (snapshot of base box volume).
==> ubuntu-vm: Creating domain with the following settings...
==> ubuntu-vm: -- Name: vagrant-vm_ubuntu-vm
==> ubuntu-vm: -- Domain type: kvm
==> ubuntu-vm: -- Cpus: 1
==> ubuntu-vm: -- Memory: 512M
==> ubuntu-vm: -- Management MAC:
==> ubuntu-vm: -- Loader:
==> ubuntu-vm: -- Nvram:
==> ubuntu-vm: -- Base box: ubuntu20.04-arm64
==> ubuntu-vm: -- Storage pool: default
==> ubuntu-vm: -- Image: /var/lib/libvirt/images/vagrant-vm_ubuntu-vm.img (10G)
==> ubuntu-vm: -- Volume Cache: default
==> ubuntu-vm: -- Kernel:
==> ubuntu-vm: -- Initrd:
==> ubuntu-vm: -- Graphics Type: vnc
==> ubuntu-vm: -- Graphics Port: -1
==> ubuntu-vm: -- Graphics IP: 127.0.0.1
==> ubuntu-vm: -- Graphics Password: Not defined
==> ubuntu-vm: -- Video Type: cirrus
==> ubuntu-vm: -- Video VRAM: 9216
==> ubuntu-vm: -- Sound Type:
==> ubuntu-vm: -- Keymap: en-us
==> ubuntu-vm: -- TPM Path:
==> ubuntu-vm: -- INPUT: type=mouse, bus=ps2
==> ubuntu-vm: Creating shared folders metadata...
==> ubuntu-vm: Starting domain.
There was an error talking to Libvirt. The error message is shown below:
Call to virDomainCreateWithFlags failed: unsupported configuration: CPU mode 'host-model' for aarch64 kvm domain on aarch64 host is not supported by hypervisor
我的 Vagrantfile 是:
UbuARM = "ubuntu20.04-arm64"
Vagrant.configure("2") do |config|
config.vm.define "ubuntu-vm" do |nodeconfig|
nodeconfig.vm.box = UbuARM
nodeconfig.vm.hostname = "ubuntu-vm"
nodeconfig.vm.network :public_network,
bridge: "br0",
dev: "br0",
mode: "bridge",
type: "bridge"
nodeconfig.vm.provider :libvirt do |libvirt|
libvirt.uri="qemu:///system"
libvirt.storage_pool_name = "default"
libvirt.storage_pool_path = "/var/lib/libvirt/images"
libvirt.features = [] # had to put this to solve some error
end
end
end
在大多数情况下,qemu for ARM64 不支持 vagrant 的默认选项。
在这种情况下,cpu_mode 的默认值为 'host-model',体系结构不支持它。您可以使用 'host-passthrough'.
提示:对于任何试图在 ARM64 中使用 vagrant-libvirt 进行虚拟化的人,我建议转储 libvirt XML 域定义并使用 vagrant-libvirt 插件选项复制它。
这些选项对我很有用:
libvirt.features = ["apic", "gic version='2'"]
libvirt.machine_type = "virt-5.2"
libvirt.machine_arch = "aarch64"
libvirt.loader = "/usr/share/AAVMF/AAVMF_CODE.fd"
libvirt.cpu_mode = "host-passthrough"
libvirt.input :type => "mouse", :bus => "usb"
libvirt.input :type => "keyboard", :bus => "usb"
libvirt.usb_controller :model => "qemu-xhci"
libvirt.video_type = "vga"
libvirt.channel :type => 'unix', :target_type => 'virtio', :target_name => 'org.qemu.guest_agent.0', :target_port => '1', :source_path => '/var/lib/libvirt/qemu/channel/target/domain-1-ubuntu20.04/org.qemu.guest_agent.0', :source_mode => 'bind'