Неподдерживаемая ошибка конфигурации при создании поставщика libvirt vagrant VM

avatar
javier
27 июля 2021 в 23:27
282
1
0

Я создаю бродячий базовый блок сервера Ubuntu 20.04 для поставщика libvirt для платформы arm64. Я уже создал базовый блок из файла образа qcow2.

При попытке создать бродячий ящик с помощью команды vagrant up я получаю сообщение об ошибке в конце вывода:

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
Источник

Ответы (1)

avatar
javier
31 июля 2021 в 11:59
0

В большинстве случаев qemu для ARM64 не поддерживает параметры vagrant по умолчанию.

В этом случае значением по умолчанию для cpu_mode является 'host-model', которое не поддерживается архитектурой. Вы можете использовать 'host-passthrough'.

СОВЕТ: всем, кто пытается виртуализировать с помощью vagrant-libvirt в ARM64, я рекомендую сбросить определение домена 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'