[vbox-dev] Machine state RESETING Event

Maxime Dor max at kamax.io
Tue Nov 24 01:22:01 GMT 2015


Hi Klaus,

On 16/11/15 13:09, Klaus Espenlaub wrote:
> Hi Max,
>
> On 13.11.2015 21:24, Maxime Dor wrote:
>> Hi,
>>
>> Following up on this topic
>> (https://forums.virtualbox.org/viewtopic.php?f=9&t=69975) and this
>> specific statement that no OnMachineStateChanged event is being sent
>> when the VM state change to RESETTING.
> The VM states are not directly visible through the API, and there is no
> corresponding MachineState for VMSTATE_RESETTING.
>
>> I have tried in Java to get that event, on IVirtualBox and IConsole on a
>> shared locked ISession but with no luck. Is that specific state
>> restricted to the process with a Write lock or the process actually
>> running the VM? Could it be possible to get an event for that VM state
>> change?
> Why? From the MachineState perspective a reset keeps the VM in state
> Running. Introducing a new transient MachineState for this is effort
> (and causes some incompatibility), and as it is extremely short term I
> wonder how useful it is in general.
>
> Bolting actions to this event is race-prone, because the VM keeps going
> (with a brief pause, in the order of 100msec).

The use case to know a VM has reset is mainly for automation/management 
tools: have a clear, defined and reliable way to know the VM has reset 
and know when to proceed further, mainly after requesting the guest OS 
to reboot.
Right now we are left with black magic, mixing:
- Guest additions state events
- Guest properties change
- Image comparison logic on screenshots of the console to see when an 
identified image shows up (BIOS screen, OS-specific loading screen, etc).

Simply ugly for something that is already known by the VM engine.

I do think we need a new state transition for this, or even a state at 
all, so I wouldn't go that way.
See below.

>
>> If not, could you consider adding some kind of event to inform API
>> clients that a VM was reset? This is definitly a useful event to get
>> from a developper PoV.
> There's an undocumented flag for turning resets into VM poweroff (with
> additional information recorded to be able to distinguish it from a
> regular poweroff).
>
> Wonder if that would be the cleaner approach, for the forum post and in
> general.

That is definitely more in line with what I had (and the forum OP) in mind.
We do not need to know the state VM, we just need to be informed that 
the VM engine itself has reset, ideally why (request from console, guest 
request, etc.).
This info is already present since it shows up in the logs! All you need 
(yes I make it sound simple I know) is to fire an event.

The VM poweroff with additional info seems like a good start. Could you 
let me know how to enable that and what kind of extra info to look for 
and how to access it (if even possible in Java?).

Ideally, just another event dedicated to it, not related to a state 
change, would be ideal.
Bonus: it doesn't change current client's behaviour, it would just be a 
new event that would be left unhandled for those unaware of it.

Thank you for your time and support, as always!

Max

>
> Klaus
>> Max
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev





More information about the vbox-dev mailing list