VBoxManage.exe错误:在从Jenkins运行时找不到名为“Windows-PC”的已注册虚拟机。

6

以下是我的环境细节: 1. 我在Jenkins中添加了两个节点(win7x64和winserver2008R2)作为从节点。 2. 我已经在这两个系统上安装了VirtualBox,并创建了具有相同MachineName、VM Name和Snapshot名称的VirtualBox映像。 3. 现在我有一个批处理文件,其中包含以下命令:

    cd /d "C:\Program Files\Oracle\VirtualBox"
    VBoxManage snapshot "Windows-PC" restore "CleanPC"
    VBoxManage startvm "Windows-PC"

    VBoxManage --nologo guestcontrol "Windows-PC" execute --image "c:\\IntegrationTestAssemblies\\RunIntegrationTests.bat" --username "user1" --password "pwdddd" --wait-exit --wait-stdout --wait-stderr

    VBoxManage controlvm WindowsPC poweroff
  1. 我手动在主机/从机上运行此命令时,它可以完美地工作。我已经检查了虚拟机是否已注册,VBoxManage list vms 也返回了虚拟机列表。

  2. 但是问题是,当我尝试通过 Jenkins 的“多配置项目”来运行它时,它无法启动虚拟机并显示错误信息:

    [exec] C:\Program Files\Oracle\VirtualBox>VBoxManage.exe snapshot "Windows-PC" restore "CleanPC" [exec] [exec] C:\Program Files\Oracle\VirtualBox>VBoxManage.exe startvm "Windows-PC" [exec] [exec] 2015年2月25日 下午7:33:18: error: VBoxManage.exe: error: Could not find a registered machine named 'Windows-PC' [exec] VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee IUnknown [exec] VBoxManage.exe: error: Context: "FindMachine(bstrMachine.raw(), ptrMachine.asOutParam())" at line 280 of file VBoxManageSnapshot.cpp [exec] VBoxManage.exe: error: Could not find a registered machine named 'Windows-PC' [exec] VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee IUnknown [exec] VBoxManage.exe: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 575 of file VBoxManageMisc.cpp

  3. 有什么线索可以指出设置出了问题吗?


你好!我有完全相同的问题,你找到解决方案了吗? - Eugen
解决方案:已登录的用户和 Jenkins slave 应该作为管理员运行。 - Ashok Mazumder
1个回答

9
你可以先尝试注册虚拟机:
VBoxManage registervm your_virtual_machine.vbox

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接