[vbox-dev] Session problem when start two virtual machines together

Klaus Espenlaub klaus.espenlaub at oracle.com
Wed Sep 15 08:28:36 GMT 2010


On 14.09.2010 19:44, DavidW wrote:
> Sounds good, maybe the email should set to make "reply all" work for this
> way.

"reply all" does work - but it means you need to use the right reply 
function in the mail client. Due to many requests some time ago we 
disabled the "reply to mailing list". Just FYI.

> -----Original Message-----
> From: Klaus Espenlaub [mailto:klaus.espenlaub at oracle.com]
> Sent: Tuesday, September 14, 2010 2:33 AM
> To: DavidW
> Subject: Re: [vbox-dev] Session problem when start two virtual machines
> together
>
> Please stay on the mailing list for such issues. I'm ignoring personal
> mails which would help others if they'd be discussed in public.
>
> Klaus
>
> On 13.09.2010 20:16, DavidW wrote:
>> Does that mean ISession_close is not much useful, you could close session
>> when there is activity in the session, and when you open the session
> again,
>> you still have what you had before you close the session, in this case the
>> openremotesession progress.
>>
>> I thought IWebsessionManager is like a login. So it doesn't work like a OS
>> login, where you can login once and do things on all objects and then
> close
>> it.

It is like a login, and each session needs to be authenticated 
individually. The SDK docs describe this pretty clearly (and the next 
major version will be even more verbose).

You can find the SDK docs for the current release on the VirtualBox 
website, http://www.virtualbox.org/wiki/Technical_documentation

>> Is the right way that I should have one IWebsessionManager for each VM,
> for
>> all its cycle, from create to destroy. If I get a new IWebsessionManager
> and
>> get the session object in it to manipulate a VM, I could have same
> problem,
>> right? In this case, I could have one IWebsessionManager and
>> openremotesession on the VM, then I close the session even the progress is
>> not done, then after 1 second for example, If I open another
>> IWebsessionManager and try to access the VM, I could have conflict
> problem?

Correct, you need to use the right ISession reference throughout. If you 
search for inspiration how this is used in bigger applications it might 
be a good idea e.g. to have a look at phpvirtualbox.

>> Should I create IWebsessionManager for each VM and store the Session
>> somewhere and use it until the VM is destroyed?

That's how it's described in the SDK docs (actually it describes keeping 
the IWebsessionManager reference around, but that's the same thing since 
you can always invoke the getSessionObject method and for the same mgr 
it always returns the same session as you observed). Since 
IWebsessionManager instances are local objects in the client they're 
quite cheap.

Klaus

>> -----Original Message-----
>> From: Klaus Espenlaub [mailto:klaus.espenlaub at oracle.com]
>> Sent: Monday, September 13, 2010 4:50 AM
>> To: DavidW
>> Subject: Re: [vbox-dev] Session problem when start two virtual machines
>> together
>>
>> On 13.09.2010 02:05, DavidW wrote:
>>> To start two virtual machines which are in "savedstate", I want to use
>>> webservice to start them together, not one after another. Since
>>> openRemoteSession returns immediately with a iprogress object, I think I
>>> just need call openRemoteSession on both virtual machines and then wait
>>> for them. But I got "The given session is already open or being opened"
>>> when I trid to openRemoteSession on the second VM. See below, any idea
>>> why it gave that error? Is it reasonable the session id in step 1 and
>>> step 4 are the same? What should I do to make it work? Thanks.
>>
>> Your code needs 2 sessions, however you use one session for two jobs.
>>
>> Each IWebsessionManager instance holds exactly one session object, and
>> thus two calls to getSessionObject will return the same object id.
>>
>> So you need to logon twice to have two sessions in parallel, use the
>> appropriate IWebsessionManager instance for each job and so on.
>>
>> The behavior you observe is exactly as expected.
>>
>> Klaus
>>
>>> 1,IWebsessionManager_getSessionObject - return session id -
>>> 452ad4c9d2537d44-0000000000046209
>>>
>>> 2,IVirtualBox_openRemoteSession - on vm 1
>>>
>>> n Keep the returned iprogress
>>>
>>> 3,ISession_close
>>>
>>> 4,IWebsessionManager_getSessionObject - return session id -
>>> 452ad4c9d2537d44-0000000000046209
>>>
>>> 5,IVirtualBox_openRemoteSession - on vm 2 - got"The given session is
>>> already open or being opened"
>>>
>>> n Keep the returned iprogress
>>>
>>> 6,ISession_close
>>>
>>> 7,waitForCompletion on iprogress 1
>>>
>>> 8,waitForCompletion on iprogress 2
>>>
>>>
>>>
>>> _______________________________________________
>>> vbox-dev mailing list
>>> vbox-dev at virtualbox.org
>>> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>


-- 
Oracle <http://www.oracle.com>
Dr. Klaus Espenlaub | Principal Software Engineer
Phone: +49 7151 60405 205 <tel:+49715160405205>
Oracle VirtualBox

ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven

Green Oracle <http://www.oracle.com/commitment> 	Oracle is committed to
developing practices and products that help protect the environment





More information about the vbox-dev mailing list