I try to restore the snapshot of a Saved/PowerDown machine but fail.

The VM has a snapshot called 'snapshot' before it's powered on. The VM has
been
powered on by IVirtualBox::openRemoteSession().

<code>
  // 'manager' is a IWebSessionManager objec
  // 'vbox' is a IVirtualBox object
  ISession session = manager.getSesscionObject(vbox);
  // machine
  vbox.openExistingSession(session, machine.getId());
  ISnapshot snapshot1 = machine.findSnapshot("snapshot1");
  IProgress progress = session.getConsole().saveState();
  progress.waitForCompletion(-1);
  long result = progress.getResultCode();
  session.getConsole().restoreSnapshot(snapshot);
<code>

Error from vboxwebsrv.exe:

  API return code:            0x80BB0002 (VBOX_E_INVALID_VM_STATE)
  COM error info result code: 0x80BB0002
  COM error info text:        The virtual machine is being powered down

Several notes:
* Even if I do powerDown() instead of saveState(),restoreSnapshot() still
fails.
* 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.
* 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.

Alex Barna.
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to