<div><div>I try to restore the snapshot of a Saved/PowerDown machine but fail.</div><div><br></div><div>The VM has a snapshot called 'snapshot' before it's powered on. The VM has been </div><div>powered on by IVirtualBox::openRemoteSession().</div>
<div><br></div><div><code></div><div>  // 'manager' is a IWebSessionManager objec</div><div>  // 'vbox' is a IVirtualBox object</div><div>  ISession session = manager.getSesscionObject(vbox);</div><div>
  // machine</div><div>  vbox.openExistingSession(session, machine.getId());</div><div>  ISnapshot snapshot1 = machine.findSnapshot("snapshot1");</div><div>  IProgress progress = session.getConsole().saveState();</div>
<div>  progress.waitForCompletion(-1);</div><div>  long result = progress.getResultCode();</div><div>  session.getConsole().restoreSnapshot(snapshot);    </div><div><code></div><div><br></div><div>Error from vboxwebsrv.exe:</div>
<div><br></div><div>  API return code:            0x80BB0002 (VBOX_E_INVALID_VM_STATE)</div><div>  COM error info result code: 0x80BB0002</div><div>  COM error info text:        The virtual machine is being powered down</div>
<div>  </div><div>Several notes:</div><div>* Even if I do powerDown() instead of saveState(),restoreSnapshot() still fails.</div><div>* I call ISession::getState() before restoreSnapshot(), and it's CLOSED.</div></div>
<div>This confuse me. The documentations says restoreSnapshot() cannot be </div><div>executed on a running machine, so I power it down first, but after powering </div><div>down, the session is *closed*, meaning that I cannot use the session object </div>
<div>to restore the snapshot.</div><div>* I notice that phpvirtualbox doesn't use IWebSessionManager and neither </div><div>openRemoteSession(). Instead it uses openSession() to open a direct session.</div><div>I cannot do this since I am doing every operations remotely instead of writing a </div>
<div>frontend.</div><div><br></div><div>Alex Barna.</div>