[vbox-dev] How can a Linux program inside a VM find out that a VM has just been restored.

Knut St. Osmundsen bird at sun.com
Mon Apr 12 00:54:28 GMT 2010


On Apr 11, 2010, at 18:21, kernalist wrote:

> Hi, I am developing a Linux program which runs inside VirtualBox  
> (i.e. the guest OS is Linux). The program needs to know the moment  
> when a VM has been restored. Is there a way for a program to find  
> this out?
>
> I looked through some of the code, and saw some events which  
> presumably are sent to a VM. However, how can I catch these events  
> in my program inside a VM, and which events am I exactly interested  
> in?

Currently there is no official way of determining this. Hmm... One  
idea which might work though is watching /VirtualBox/HostInfo/VBoxVer  
for changes. I'm not entirely sure if waiting on it will work as that  
variable + restore might be a bit of an edge case at the moment.  But  
if it works, the following command should return after a restore:
	VBoxControl wait /VirtualBox/HostInfo/VBoxVer

If it doesn't try poll for timestamp changes using:
	while true; do VBoxControl get /VirtualBox/HostInfo/VBoxVer -verbose;  
sleep 2; done


We have plans to add a dedicated guest property for signaling restore  
events in one of the next releases. When we do that we will make sure  
waiting on it will work 100% upon restore.

--

Kind regards / Mit freundlichen Gruessen / Vennlig hilsen,
   Knut

--

Sun Microsystems GmbH        Knut St. Osmundsen
Werkstrasse 24               Senior Staff Engineer, VirtualBox
71384 Weinstadt, Germany     mailto:bird at sun.com

==================================================
Sitz der Gesellschaft: Sun Microsystems GmbH,
Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Gesch?ftsf?hrer: Thomas Schroeder, Wolfgang Engels
Vorsitzender des Aufsichtsrates: Martin Haering
==================================================





More information about the vbox-dev mailing list