使用 packer 创建一个 vagrant qemu/kvm box

Using packer to create a vagrant qemu/kvm box

我正在尝试使用 qemu/kvm hypervisor 和 packer 构建一个 vagrant .box。我正在使用 vagrant 插件 vagrant-libvirt.

在我的加壳器 base.json 文件中,我使用了 vagrant post-处理器,比如

"post-processors": [
    {
        "type": "vagrant",
        "output": "output/my-ubuntu_14.04_packer.box"
    }
],

然而,当我构建盒子时,我在日志中收到此错误:

2015/12/22 20:11:57 ui error: Build 'qemu' errored: 1 error(s) occurred:
* Post-processor failed: Unknown artifact type, can't build box: transcend.qemu

我已经调查过这个问题,它似乎是由 post 处理器配置引起的。例如,根据对话 here, qemu did not support the vagrant post processor at that time. However, looking at this it should work now that this pull request 进行合并。

事实上,流浪者 post 处理器的 documentation 似乎将 qemu 列为受支持的提供者。

我相信这是因为我目前正在使用 Packer v0.6.0(2014 年 5 月 2 日发布)。直到 Packer v0.7.2(2014 年 10 月 28 日发布)才支持 vagrant post-处理器,因此需要升级才能实现此目的。