VBox GUI hangs after power up the VM.

Discussion about using the VirtualBox API, Tutorials, Samples.

VBox GUI hangs after power up the VM.

Postby siuks24 » 9. Jul 2019, 13:57

Hi,
Is possible to use VBox GUI and other application using VBox API in the same time? When I run a virtual machine using IConsole::PowerUp(), virtual machine works correctly but GUI of VBox hangs. GUI works OK until I execute the line " console->PowerUp(&progress);". Is it the expected behavior or had I done something wrong? I'v not found any information which mentioned that start of VM(via IConsole::StartUp) causes hang of VBox GUI.
siuks24
 
Posts: 12
Joined: 28. Mar 2019, 18:04

Re: VBox GUI hangs after power up the VM.

Postby socratis » 10. Jul 2019, 09:20

siuks24 wrote:Is possible to use VBox GUI and other application using VBox API in the same time?
Absolutely! You can use VBoxManage commands while the Manager is running, and any changes you do in the CLI will be reflected in the GUI. So, yes, it does work.

Unfortunately I don't know enough on the programming/API level to help you any further. Perhaps a visit on the IRC channel (#vbox-dev) might help you...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 26024
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: VBox GUI hangs after power up the VM.

Postby noteirak » 11. Jul 2019, 14:15

VM sessions are designed around locks. When you create a session in the API, which allows you to access the console per example, you give a lock type. If you use an exclusive lock, then yes you will block any other process to access the VM.
If you directly use the IConsole object, then you consider yourself the process owner of the VM while its running, which will block the GUI to perform some tasks indeed.

If you do not want to be a process owner but replicate what the GUI does, starting a VM should be done using IMachine::launchVMProcess which properly handling locking.
Hyperbox - Virtual Infrastructure Manager - https://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5198
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7

Re: VBox GUI hangs after power up the VM.

Postby siuks24 » 11. Jul 2019, 15:55

Thanks noteirak. I have to be a process owner because I need to attach my own frame buffer to VM. I understand that if I run eg Machine1 then that machine is unavailable from GUI, but what with other machines? what if I would like to run two different machines: the first one via my app , the second one via GUI? Right now when I start virtual machine via my app whole GUI hang(I get message that window isn't responding) and I can do nothing. I'm trying to resolve this problem but I don't know if it cause by my mistake or if it's expected behavior of VBox. Do you know something about it?
siuks24
 
Posts: 12
Joined: 28. Mar 2019, 18:04

Re: VBox GUI hangs after power up the VM.

Postby noteirak » 11. Jul 2019, 15:58

I never went into that specific of the source code, but basically you need to perform specific steps when it comes to being the process owner. There is a third lock type which can be used for that specific purpose and will allow to keep a "master" lock and then allow other processes to have other kind of locks. My advise is to check the VBoxManage code and the VBoxHeadless to see how that lock dance is done. You would simply want to replicate the same I believe.
Hyperbox - Virtual Infrastructure Manager - https://kamax.io/hbox/
Manage your VirtualBox infrastructure the free way!
noteirak
Site Moderator
 
Posts: 5198
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7


Return to The VirtualBox API

Who is online

Users browsing this forum: No registered users and 1 guest