[vbox-dev] Help with sessions

Lucas Charles lucas.charles at unine.ch
Thu Nov 4 09:46:38 GMT 2010


Ok, thank you very much for taking the time to answer !

Lucas

On Tue, Nov 2, 2010 at 11:35 AM, Klaus Espenlaub <klaus.espenlaub at oracle.com
> wrote:

> On 26.10.2010 00:44, Lucas Charles wrote:
>
>> Hi Nikolay,
>>
>>
>> Thank you very much for sorting this out, now it's solved.
>> What I actually didn't get was that I had to close the session after
>> openRemoteSession. (My bad)
>>
>> 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.
>>
>
> That sounds quite plausible... loading a saved state alone isn't for free
> if your VM has lots of RAM configured. You could have a peek at VBox.log if
> you wonder where the time is spent. If it's in the management of diff images
> it doesn't show up there though, since it's done before the VM is started.
>
> All snapshot management operations are complex file operations, especially
> if you delete non-"leaf" snapshots. Restoring some snapshot is comparably
> simple, it "only" means creating a new diff image (and potentially deleting
> the previous one), which doesn't need much file I/O. It still depends
> heavily on the disk speed and load.
>
> Klaus
>
>
>> - Does it make any sense ?
>>
>> Lucas
>>
>> On Mon, Oct 25, 2010 at 4:46 PM, Nikolay Igotti
>> <nikolay.igotti at oracle.com <mailto:nikolay.igotti at oracle.com>> wrote:
>>
>>      Hi Lucas,
>>
>>
>>
>>    Lucas Charles wrote:
>>
>>        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.
>>
>>    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.
>>
>>        I understood that openRemoteSession is used to start a vm and I
>>        used this call to open several vms.
>>        The problem is how to access this session once it has been opened.
>>
>>    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.
>>
>>
>>
>>        Up to know I passed the same session object to every open remote
>>        session call, which is apparently wrong.
>>        I tried to reused this session object to command the snapshots,
>>        and it apparently failed. I understood that a session is
>>        linked to one machine, so it makes sense that I cannot reuse
>>        them everywhere.
>>
>>    Yes, you need one session per machine. See my getSessionObject()
>>    remark above.
>>
>>
>>
>>        I saw in some threads in the mailing list that I could create
>>        one IWebsessionManager to start all the vms and then
>>        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.
>>
>>    You need different managers if you maintain connection to multiple
>>    VirtualBox hosts, if you all your VMs run on the same host/port
>>    there is no need for multiple managers.
>>
>>      Nikolay
>>
>>
>>
>>        On Mon, Oct 25, 2010 at 11:14 AM, Nikolay Igotti
>>        <nikolay.igotti at oracle.com <mailto:nikolay.igotti at oracle.com>
>>        <mailto:nikolay.igotti at oracle.com
>>        <mailto:nikolay.igotti at oracle.com>>> wrote:
>>
>>               Hi Lucas,
>>
>>
>>            First of all, please keep in mind that for next major release
>>            there will be significant rework of both session API and
>>            the way it's accessed from Java. Having said that, with 3.x
>>             approach, which is, indeed not very straightforward,
>>            openRemoteSession() API is just a way start a new VM, so
>>        it's not
>>            possible to use one remote session to start several VMs -
>>            you have to openRemoteSession() for every VM you want to start.
>>            Please refer to SDK documentation, and vboxshell.py TUI example
>>            (while in Python, patterns of API usage is the same).
>>
>>
>>            Hope that will help,
>>              Nikolay
>>
>>
>>            Lucas Charles wrote:
>>
>>                Hello everyone,
>>
>>                I'm stuck with a problem related to the sdk for java-ws.
>>                I want to manage several machines on a given host from
>>        my java
>>                client.
>>
>>                I need to start vms Take snapshots of the one I started at
>>                given intervals.
>>                After a new boot I need to restore the machines to their
>>                latest snapshot.
>>                Start them and redo snapshots.
>>
>>                The problem I'm facing is how to open sessions.
>>
>>                Yet I'm starting the vms by calling
>>                ------
>>
>>                IWebsessionManager mgr;
>>
>>                IVirtualBox vbox
>>
>>                mgr = new IWebsessionManager("http://localhost:18083");
>>
>>                vbox = mgr.logon("", "");
>>
>>                ISession session = mgr.getSessionObject(vbox);
>>
>>                IProgress prog = vbox.openRemoteSession(session,
>>                machineToStart.getId(), "gui", "");
>>
>>                prog.waitForCompletion(-1);
>>
>>                -----
>>
>>                Isn't it a problem to call openRemoteSession with the
>>        session
>>                I got from IWebSessionManager::getSessiontObject() ?
>>                Because I then use only one session to start several vms.
>>
>>                My next question is when I want to take snapshots of every
>>                machines I have in charge.
>>
>>                Which session object should I use to get the IConsole ?
>>                Can/Must I reuse the one I used upon calling
>>                openRemoteSession() ? Reusing seems to work, if I
>>        control only
>>                one machine but fails with more than one.
>>
>>                Best Regard,
>>                Lucas Charles
>>
>>
>>  ------------------------------------------------------------------------
>>
>>                _______________________________________________
>>                vbox-dev mailing list
>>        vbox-dev at virtualbox.org <mailto:vbox-dev at virtualbox.org>
>>        <mailto:vbox-dev at virtualbox.org <mailto:vbox-dev at virtualbox.org>>
>>
>>
>>        http://vbox.innotek.de/mailman/listinfo/vbox-dev
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> vbox-dev mailing list
>> vbox-dev at virtualbox.org
>> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>>
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20101104/e92c53e5/attachment.html>


More information about the vbox-dev mailing list