Hi Nikolay,<div><br></div><div><br><div>Thank you very much for sorting this out, now it's solved.</div><div>What I actually didn't get was that I had to close the session after openRemoteSession. (My bad)</div><div>

<br></div><div>I just had one question, it seems to me that using snapshot (Either restore the snapshot or start from a saved one) can be really expensive if I have modifications on the harddrive.. It takes something like 5-10 seconds to recover form a snapshot that has been done after an install of a few package in an Ubuntu guest.</div>

<div><br></div><div>- Does it make any sense ?</div><div><br></div><div><div>Lucas</div><div><br><div class="gmail_quote">On Mon, Oct 25, 2010 at 4:46 PM, Nikolay Igotti <span dir="ltr"><<a href="mailto:nikolay.igotti@oracle.com" target="_blank">nikolay.igotti@oracle.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 Hi Lucas,<div><br>
<br>
<br>
Lucas Charles wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks also for reminding me the change of the API, I also remember that there should be an xpcom-like API for java in the next version.<br>
</blockquote></div>
Yes, but look and feel of both WS and XPCOM API shall be the same, and you can use pretty much the same Java code for both.<div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I understood that openRemoteSession is used to start a vm and I used this call to open several vms.<br>
The problem is how to access this session once it has been opened.<br>
</blockquote></div>
To create a session object you may want to use getSessionObject(). Complete example can be found in src/VBox/Main/webservice/samples/java/jax-ws/clienttest.java which is also shipped with SDK.<div><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Up to know I passed the same session object to every open remote session call, which is apparently wrong.<br>
I tried to reused this session object to command the snapshots, and it apparently failed. I understood that a session is<br>
linked to one machine, so it makes sense that I cannot reuse them everywhere.<br>
</blockquote></div>
Yes, you need one session per machine. See my getSessionObject() remark above.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I saw in some threads in the mailing list that I could create one IWebsessionManager to start all the vms and then<br>
create one IWesessionManager per machine started to create new session objects. Is it really the right thing to do, since the IVirtualbox is a singleton.<br>
</blockquote></div>
You need different managers if you maintain connection to multiple VirtualBox hosts, if you all your VMs run on the same host/port<br>
there is no need for multiple managers.<br>
<br>
 Nikolay<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
<br>
On Mon, Oct 25, 2010 at 11:14 AM, Nikolay Igotti <<a href="mailto:nikolay.igotti@oracle.com" target="_blank">nikolay.igotti@oracle.com</a> <mailto:<a href="mailto:nikolay.igotti@oracle.com" target="_blank">nikolay.igotti@oracle.com</a>>> wrote:<br>




<br>
       Hi Lucas,<br>
<br>
<br>
    First of all, please keep in mind that for next major release<br>
    there will be significant rework of both session API and<br>
    the way it's accessed from Java. Having said that, with 3.x<br>
     approach, which is, indeed not very straightforward,<br>
    openRemoteSession() API is just a way start a new VM, so it's not<br>
    possible to use one remote session to start several VMs -<br>
    you have to openRemoteSession() for every VM you want to start.<br>
    Please refer to SDK documentation, and vboxshell.py TUI example<br>
    (while in Python, patterns of API usage is the same).<br>
<br>
<br>
    Hope that will help,<br>
      Nikolay<br>
<br>
<br>
    Lucas Charles wrote:<br>
<br>
        Hello everyone,<br>
<br>
        I'm stuck with a problem related to the sdk for java-ws.<br>
        I want to manage several machines on a given host from my java<br>
        client.<br>
<br>
        I need to start vms Take snapshots of the one I started at<br>
        given intervals.<br>
        After a new boot I need to restore the machines to their<br>
        latest snapshot.<br>
        Start them and redo snapshots.<br>
<br>
        The problem I'm facing is how to open sessions.<br>
<br>
        Yet I'm starting the vms by calling<br>
        ------<br>
<br>
        IWebsessionManager mgr;<br>
<br>
        IVirtualBox vbox<br>
<br>
        mgr = new IWebsessionManager("<a href="http://localhost:18083" target="_blank">http://localhost:18083</a>");<br>
<br>
        vbox = mgr.logon("", "");<br>
<br>
        ISession session = mgr.getSessionObject(vbox);<br>
<br>
        IProgress prog = vbox.openRemoteSession(session,<br>
        machineToStart.getId(), "gui", "");<br>
<br>
        prog.waitForCompletion(-1);<br>
<br>
        -----<br>
<br>
        Isn't it a problem to call openRemoteSession with the session<br>
        I got from IWebSessionManager::getSessiontObject() ?<br>
        Because I then use only one session to start several vms.<br>
<br>
        My next question is when I want to take snapshots of every<br>
        machines I have in charge.<br>
<br>
        Which session object should I use to get the IConsole ?<br>
        Can/Must I reuse the one I used upon calling<br>
        openRemoteSession() ? Reusing seems to work, if I control only<br>
        one machine but fails with more than one.<br>
<br>
        Best Regard,<br>
        Lucas Charles<br>
        ------------------------------------------------------------------------<br>
<br>
        _______________________________________________<br>
        vbox-dev mailing list<br></div></div>
        <a href="mailto:vbox-dev@virtualbox.org" target="_blank">vbox-dev@virtualbox.org</a> <mailto:<a href="mailto:vbox-dev@virtualbox.org" target="_blank">vbox-dev@virtualbox.org</a>><div><br>
        <a href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target="_blank">http://vbox.innotek.de/mailman/listinfo/vbox-dev</a><br>
         <br>
<br>
<br>
</div></blockquote>
<br>
</blockquote></div><br>
</div></div></div>