作者 主題: [VBox] 關於由 host 端啟動執行 guest 端程式的問題  (閱讀 5895 次)

0 會員 與 1 訪客 正在閱讀本文。

Yamaka

  • 俺是博士!
  • *****
  • 文章數: 4913
    • 檢視個人資料
    • http://www.ecmagic.com
最近有個需求, 就是要在 host 端啟動執行 guest 內的程式
基本上是沒問題, 用『VBoxManage guestcontrol』就可以
但是同時開了幾個程式後卻出現錯誤訊息, 例如...

代碼: [選擇]
$ VBoxManage guestcontrol "WinXP01" execute --image "mspaint.exe" --username Administrator --password 1234567
$ VBoxManage guestcontrol "WinXP01" execute --image "mspaint.exe" --username Administrator --password 1234567
$ VBoxManage guestcontrol "WinXP01" execute --image "mspaint.exe" --username Administrator --password 1234567
$ VBoxManage guestcontrol "WinXP01" execute --image "mspaint.exe" --username Administrator --password 1234567
$ VBoxManage guestcontrol "WinXP01" execute --image "mspaint.exe" --username Administrator --password 1234567
$ VBoxManage guestcontrol "WinXP01" execute --image "mspaint.exe" --username Administrator --password 1234567
VBoxManage: error: Concurrent guest process limit is reached.
$

爬了一下估狗也沒找到原因與解法, 後來是直接查看 vbox 使用手冊
使用手冊上有一些相關說明..


https://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol

引用
Starting at VirtualBox 4.1.2 guest process execution by default is limited to serve up to 5 guest processes at a time.
If a new guest process gets started which would exceed this limit,
the oldest not running guest process will be discarded in order to be able to run that new process.
Also, retrieving output from this old guest process will not be possible anymore then.
If all 5 guest processes are still active and running, starting a new guest process will result in an appropriate error message.

若要能同時跑更多程式, 解決方式就是自己去設定數量(上面手冊說明的下一段).
例如:

代碼: [選擇]
$ VBoxManage guestproperty set "WinXP01" /VirtualBox/GuestAdd/VBoxService/--control-procs-max-kept 12
$


在 xp 的命令列執行這行..

代碼: [選擇]
C:\>VBoxControl guestproperty enumerate
.......
Name: /VirtualBox/GuestAdd/VBoxService/--control-procs-max-kept, value: 12, time
stamp: 1321255575158799000, flags: <NULL>
.......

新的屬性資料已確實寫入, 或是查看 guest 的設定檔『WinXP01.xml』
也會多一項設定資料..

代碼: [選擇]
<GuestProperty name="/VirtualBox/GuestAdd/VBoxService/--control-procs-max-kept" value="12" timestamp="1321255575158799000" flags=""/>
guest 重新開機後, host 端就可以同時開啟12個程式了  ;D


=====
但是有一個問題還是找不到解法, 就是..
如果要執行的程式打錯路徑檔名, 或是找不到檔案
那也會算是一個已開啟的『process』
所以這時可開啟的 process 就等於少了一個
要如何清除這個『process』一直都找不到方法
目前只能使用重新啟動 guest 的笨方式
有人知道有無可以直接清除的指令嗎?


netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
改用 ssh 去 run 如何?

Yamaka

  • 俺是博士!
  • *****
  • 文章數: 4913
    • 檢視個人資料
    • http://www.ecmagic.com
嗯, 這也許也是一個解法, 找時間來試試, 感謝  :)