Page 1 of 1

Error while catching machine poweroff event via webservice

Posted: 10. Oct 2013, 17:21
by Ch00k
I am trying to catch the event of machine's poweroff (when I select Close -> Power Off in the menu). Instead of the actual event i get an error from the webservice: "(SOAP-ENV:Client) VirtualBox error: (0x800706BE)". The steps I take are the following:
1. Start the machine from GUI
2. Login to webservice, find this machine, lock it with 'Shared' lock type
3. Create a listener from Console's event source, listen for 'All' events, register listener
4. In a loop run getEvent
After i poweroff the machine the getEvent call returns the above error.
I don't know if it's relevant but here is the code I use (Ruby). It is based on the custom object-oriented SOAP API wrapper I wrote:

Code: Select all

VBox::WebService.connect
web_session = VBox::WebsessionManager.new
virtual_box = web_session.logon(:username => 'user', :password => 'password')
session = web_session.get_session_object
virtual_box.find_machine(:name_or_id => 'MACHINE1').lock_machine(:session => session, :lock_type => 'Shared')
event_source = session.console.event_source
listener = event_source.create_listener
event_source.register_listener(:listener => listener, :interesting => ['Any'])
while true
  # the error goes from here
  ev = event_source.get_event(:listener => listener)
  sleep 1
end
The XML I get in the response from vboxwebsrv is the following:

Code: Select all

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vbox="http://www.virtualbox.org/">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Client</faultcode>
      <faultstring>VirtualBox error:  (0x800706BE)</faultstring>
      <detail>
        <vbox:RuntimeFault>
          <resultCode>-2147023170</resultCode>
          <interfaceID>00000000-0000-0000-0000-000000000000</interfaceID>
          <component/>
          <text/>
        </vbox:RuntimeFault>
      </detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The thing here is that I get the error only on poweroff, the other console events like snaphots, clipboard, drag/drop are catched fine.
So where can I go from here? Maybe some debugging info I need to enable somewhere to see the root cause? I understand the info I provided might not be enough so I'll be glad to provide any additional info needed.

Re: Error while catching machine poweroff event via webservi

Posted: 13. Oct 2013, 18:03
by noteirak
The Event source is not valid anywhere, since the VM is powered off and all its associated objects are deleted.
You would get the powered off event from the Virtualbox object directly.