[vbox-dev] Fail to restore snapshot remotely

Alex alex.lavoro.propio at gmail.com
Tue Aug 10 16:54:24 GMT 2010


On 10.08.2010 17:42:51 Klaus wrote:
> what reason one could have to save the VM state and then immediately run
> restoreSnapshot() with that VM... it makes no sense whatsoever to me.

What actually I want to do is restoreSnapshot(), but since the VM is
still running, I have to first stop it. I tried to call powerDown()
but got error message in vboxwebsrv.exe:

  API return code:            0x800706BA (Unknown Status 0x800706BA)
  COM error info result code: 0x0
  COM error info text:

but the machine *is* powered down, as observed in VirtualBox GUI console.

So I tried saveState() also, this time I got another error message:

  API return code:            0x80BB0003 (VBOX_E_VM_ERROR)
  COM error info result code: 0x80BB0003
  COM error info text:        Could not suspend the machine execution
(VERR_VM_INV
  ALID_VM_STATE)

  API return code:            0x80010108 (RPC_E_DISCONNECTED)
  COM error info result code: 0x0
  COM error info text:

> Several notes:
> * Even if I do powerDown() instead of saveState(),restoreSnapshot()
> still fails.

> You need to wait until the VM is truly powered off, if you do the call
> to restoreSnapshot too early it'll fail, even if there is no other
> session open.

I did. I call IProgress:waitForComplete(), in the code snippet I posted:

<code>
IProgress progress = session.getConsole().saveState(); // or powerDown()
progress.waitForCompletion(-1);
long result = progress.getResultCode();
</code>

Either I called saveState() or powerDown(), it fails.

Sometimes I get this error message when calling saveState():

  API return code:            0x80BB0003 (VBOX_E_VM_ERROR)
  COM error info result code: 0x80BB0003
  COM error info text:        Could not suspend the machine execution
(VERR_VM_INV
  ALID_VM_STATE)

  API return code:            0x80010108 (RPC_E_DISCONNECTED)
  COM error info result code: 0x0
  COM error info text:

> > * I call ISession::getState() before restoreSnapshot(), and it's CLOSED.
> > This confuse me. The documentations says restoreSnapshot() cannot be
> > executed on a running machine, so I power it down first, but after powering
> > down, the session is *closed*, meaning that I cannot use the session object
> > to restore the snapshot.
>
> The session state is not the same as the machine state.

I know. But I need the session object to obtain IConsole, in order to
call IConsole::restoreSnapshot().  It seem to me that it's not valid
to call getConsole() on a CLOSED session object.

<code>
session.getConsole().restoreSnapshot(snapshot);
</code>

> > * I notice that phpvirtualbox doesn't use IWebSessionManager and neither
> > openRemoteSession(). Instead it uses openSession() to open a direct session.
> > I cannot do this since I am doing every operations remotely instead of
> > writing a
> frontend.
>
> That cannot be true - for starting a VM phpvirtualbox must also use
> openRemoteSession. It is not a frontend which can run VMs on its own. I
> hope you're not looking at the latest version of phpvirtualbox,

Unfortunately, yes. restoreSnaptshot() in vboxconnector.php
- http://phpvirtualbox.googlecode.com/svn/trunk/lib.


> There's so much confusion that I cannot really say much about the true
> cause of the problem, but I hope I gave a few hints which makes the
> picture somewhat clearer.

My objective is starting a VM, performing some jobs, and discard all
changes made by this job since this VM will be started again to
perform another jobs.

To discard all changes, I think I should use a snapshot.

The VM is correctly started by openRemoteSession(), I just don't know
how to correctly shut it down in order to call
IConsole::restoreSnapshot().


Alex Barna.




More information about the vbox-dev mailing list