测试厨房卡在 "creating virtual machine"

test kitchen stuck on "creating virtual machine"

运行 chefdk 在 Windows 10 上 hyperv.

我可以使用 kitchen create 创建 Windows 虚拟机,它工作正常,但我刚刚尝试了 Linux 虚拟机,但我遇到了这个错误:

PS> kitchen create
-----> Starting Kitchen (v1.10.0)
-----> Creating <default-centos-72>...
       Creating differencing disk for default-centos-72.
       Created differencing disk for default-centos-72.
       Checking for existing virtual machine.
       Creating virtual machine for default-centos-72.
       Created virtual machine for default-centos-72.

QBiA...AA== -outputformat Text ----
STDOUT:
STDERR: #< CLIXML
---- End output of c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -noprofile -executionpolicy bypass -encodedcommand LgAg...AA== -outputformat Text ----

ProcessId: 18780
app_name: c:\windows\sysnative\windowspowershell\v1.0\powershell.exe
command_line: c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -noprofile -executionpolicy bypass -encodedcommand LgAgAEM...BjADC0ASgBzAG8AbgAKAA== -outputformat Text
timeout: 600] on default-centos-72
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

现在它确实创建了一个 VM,我可以通过 PuTTY 手动 ssh 进入或通过 openssh 从 cmd 手动 Windows 所以我不知道为什么它挂起 - 看起来它不能访问它。

这是我的 .kitchen.yml:

---
driver:
  name: hyperv
  parent_vhd_folder: c:\HyperV\VHDs\
  parent_vhd_name: CentOS-7.vhdx
  vm_switch: NAT
  memory_startup_bytes: 2GB

provisioner:
  name: chef_zero

transport:
  password: MyPassw1!@#

platforms:
  - name: centos-7.2

suites:
  - name: default
    run_list:
      - recipe[myrecipe::default]
    attributes:

编辑 - 更多信息: 服务器配置为 DHCP 当我查看 .kitchen 文件夹时,日志为空 .kitche\default-centos-72.yml 只列出一个 id(不知道那是否应该像 rdp 文件一样在其中包含管理员名称和 IP? 我还尝试在 .kitchen.yml

中指向一个静态 IP

@red888 虚拟机是否有最新的来宾组件? Hyper-V 管理器是否看到与虚拟机网卡关联的 IP 地址?您可以在 hyper-v 管理器中或通过 Powershell

检查

(get-vm 'your vm name').networkadapters[0].ipaddresses

如果是,请在 https://github.com/test-kitchen/kitchen-hyperv 提交问题,我很乐意深入挖掘。

您需要最新的集成组件(我认为 4.1 是最新的 - https://www.microsoft.com/en-us/download/details.aspx?id=51612

好的,史蒂文是对的,应该早点调查一下。

这看起来可能与 this bug 有关。

正如他所建议的那样,我发现 Hyper-V 没有报告来宾的 IP,我看到了这一点:

禁用 SELinux 并重新启动似乎可以解决此错误,我可以在 Hyper-V 中看到来宾的 IP,kitchen create works。

有没有办法在不完全禁用 selinux 的情况下允许此服务访问?