vagrant - 添加额外磁盘时,Chef Kitchen Vagrant box 不会启动
问题描述
在 Mac OSX 上进行开发
编写食谱以根据未分区、安装或格式化的驱动器动态分区、格式化、安装驱动器,可能已从单驱动器 raid-0 配置中取出,或者可能尚未通过 raid 控制器配置...
在为食谱编写测试用例时。我有以下问题。
.kitchen.yml 文件:
driver:
name: vagrant
# ssh:
# insert_key: false
customize:
cableconnected1: 'on'
createhd:
- filename: /tmp/disk1.vdi
size: 128
storagectl:
- name: SATA Controller
portcount: 4
storageattach:
- storagectl: SATA Controller
port: 0
device: 0
type: hdd
medium: /tmp/disk1.vdi
privileged: true
命令:kitchen verify
卡在下面
输出:
-----> Starting Kitchen (v1.20.0)
$$$$$$ Deprecated configuration detected:
require_chef_omnibus
Run 'kitchen doctor' for details.
-----> Creating <default-centos-7>...
(erb):173: warning: constant ::Fixnum is deprecated
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/centos-7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-7' is up to date...
==> default: Setting the name of the VM: default-centos-
7_default_1526333511693_18382
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few
minutes...
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
不会再继续下去了。添加磁盘的代码直接取自用于添加磁盘的 kitchen-vagrant 文档。我可以删除 createhd、storagectl 和 storageattach 部分,此时 vagrant box 可以按预期工作。我已经验证了 /tmp/disk1.vdi 文件已创建,我还必须在运行之间删除该文件,在厨房破坏后,我会收到以下错误:
-----> Starting Kitchen (v1.20.0)
$$$$$$ Deprecated configuration detected:
require_chef_omnibus
Run 'kitchen doctor' for details.
-----> Creating <default-centos-7>...
(erb):173: warning: constant ::Fixnum is deprecated
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-7' is up to date...
==> default: Machine not provisioned because `--no-provision` is
specified.
Waiting for SSH service on 127.0.0.1:2200, retrying in 3 seconds
在我逃脱命令之前,它将继续retying in 3 seconds
无限期地卡住。
我试过有无:
ssh:
insert_key: false
我尝试了 vagrant 应该支持的不同格式的文件作为磁盘,包括.vdi, .vmdk
我确保这SATA Controller
是适用于盒子的适当控制器。
解决方案
原因是 kitchen/vagrant 试图将 OS 磁盘绑定到控制器的端口 0。所以它不启动的原因是因为没有绑定启动盘!
如果您在示例中更改port: 0
为port: 1
,它应该按预期启动。
推荐阅读
- django - 在 Django Admin 中,我的某些模型没有出现 ManyToMany 第二个框。我怎样才能显示回来?
- html - 如何在同一行对齐两组图标
- javascript - 如何在 Javascript 中将数据变量带出 .then() 方法
- javascript - 将 React Component 连接到 redux 时崩溃
- angular - 以 d3 角度包装条形图的重叠 x 轴
- reactjs - React Hook 触发重新渲染,但 React Navigation 不更新屏幕
- reactjs - Redux 使用没有 React 的功能组件
- python - MacOS 10.13 High Sierra“pip3 install”命令不起作用(SSLError)
- android - 为什么 viewBinding 使 XML 根全屏
- cloudinary - 如何使用扩展脚本将 Cloudinary 提供的图像下载到我的本地目录?