Issue take and restore snapshot commands from guest

Discussions related to using the OSE version of VirtualBox.
Post Reply
sorindev
Posts: 2
Joined: 26. Jun 2015, 09:58

Issue take and restore snapshot commands from guest

Post by sorindev »

Hi,

I'm working on a project where I need to issue two commands from the guest. The first one is to take a snapshot of the system and the other one is to revert the guest to the last snapshot.

I have added a new HGCM service and added functionality in the additions code so that I send it commands through the VBoxControl utility. The take snapshot functionality is working, but i'm having issues with the restoring of the snapshot.

When I get the restore command in my HGCM service, I start a new process that does the following:
- issue a power off for my machine
- get the last snapshot
- restore the snapshot
- start the vm

Things work fine and the machine is in the state that was right when i issued the take snapshot request. The problem is that the process that issued that command (VBoxControl.exe) is blocked, waiting for the service to unblock it, after it performed the ioctl operation.

When taking the snapshot, the process is unblocked when the service calls the pfnCallComplete callback on the message that the guest used to request the snapshot. But when the machine is restored to the snapshot, that message is lost, as the process hosting the service got killed and the message queue is stateless. One solution would be to implement the pfnSaveState and pfnLoadState callbacks for my service and try to save this message. The problem is that the message itself is too complex. It has fields which are not visible in my service and also has pointers to other dynamic structures (e.g. from the VMXDevHGCM driver).

I noticed that the VMMDevHGCM driver is saving its list of active commands. Is there any way to use this commands to unblock the guest process directly?

Thank you in advance,
Sorin
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Issue take and restore snapshot commands from guest

Post by noteirak »

Moved to "VirtualBox OSE".
This will need an answer from the developpers directly. You can also ask on the dev mailing list and point to here.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
sorindev
Posts: 2
Joined: 26. Jun 2015, 09:58

Re: Issue take and restore snapshot commands from guest

Post by sorindev »

Hi,

The VMMDevHGCM driver was correctly loading the pending command list and executing them. So, when restoring the machine, the handle for the take snapshot command got called and my code just tried to do the snapshot as it would normally do. But this failed as the machine was in the restoring state. So now I am just handling this case and return directly when the state of the machine is restoring and everything works fine.

Thanks
Post Reply