【问题标题】:Chef Kitchen Vagrant box will not start when adding additional disks添加额外磁盘时,Chef Kitchen Vagrant box 不会启动
【发布时间】:2022-01-28 02:42:45
【问题描述】:

正在 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.

不会再继续了。添加磁盘的代码直接取自用于添加磁盘的 k​​itchen-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 是适用于该盒子的合适控制器。

【问题讨论】:

    标签: vagrant chef-infra virtual-machine virtualbox test-kitchen


    【解决方案1】:

    这似乎是 vagrant 和 virtualbox 版本的问题。你可以找到类似的问题here

    【讨论】:

      【解决方案2】:

      原因是 kitchen/vagrant 试图将 OS 磁盘绑定到控制器的端口 0。所以它不启动的原因是没有绑定启动盘!

      如果您在示例中将port: 0 更改为port: 1,它应该会按预期启动。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-02-01
        • 2017-01-30
        • 1970-01-01
        • 1970-01-01
        • 2013-12-01
        • 1970-01-01
        • 1970-01-01
        • 2016-09-27
        相关资源
        最近更新 更多