我已经为 libvirt 创建了基本盒子图像,添加盒子已成功,并且它在盒子列表中可见。
[root@centos7 vagrant]# vagrant box list
rhmaster (libvirt, 0)
[root@centos7 vagrant]#
但是当尝试 vagrant up 时,它会抱怨该盒子不存在。
[root@centos7 vagrant]# vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Uploading base box image as volume into libvirt
storage...
The box 'rhmaster' does not exist. Please double check and
try again. You can see the boxes that are installed with
`vagrant box list`.
任何指导都非常感谢。
我的 metadata.json 文件:
{
"provider" : "libvirt",
"format" : "qcow2",
"virtual_size" : 30
}
我的 Vagrantfile 在框图像中添加了:
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.driver = "kvm"
libvirt.host = 'localhost'
libvirt.uri = 'qemu:///system'
libvirt.username = 'root'
libvirt.connect_via_ssh = true
end
config.vm.define :new do |rhmaster|
rhmaster.vm.box = "rhmaster"
rhmaster.vm.provider :libvirt do |domain|
domain.memory = 2048
end
end
end
答案1
我的错误文件名 box.img 包含未知字符。我猜是因为我的 XDCMP 会话的终端控制台。现在没问题了。