VMware {code} Community
ZD14a
Contributor
Contributor

CloneSession() throws "Login failed because the session could not be re-registered"

Hello,

I want to create a remote plugin for the vCenter as described in the document Developing Remote Plug-ins with the vSphere Client SDK . Unfortunately I'm not able to clone the session of the currently logged in user.

At first I request a CloneTicket via the REST-API. This works and I get a string which looks like "cst-VCT-52abe3ae-0b53-12f1-c978-abd1252b99e2--tp-12-D3-A0-45-85-74-63-3E-A6-D2-B1-A4-38-90-72-19-27-62-22-00". With this string I want to get a valid user session. As described in the document I use the cloneSession method to gain this. UnfortunatelyI get a InvalidLogin exception.

In the vcenter the log file /storage/log/vmware/vpxd/vpxd-xxx.log states

[VpxdUser] Attempt to re-register session with cnxId=529f1252-1a34-5d18-67d2-cab1fa5f5a12 failed

The id "529f1252-1a34-5d18-67d2-cab1fa5f5a12" belongs to the session I used to open the SessionManager, which is a different user than the one from which the sesssion should be cloned. I use the perl SDK for the remote plugin but even the language agnostic way via the Mob (https://[FQDN-vCenter]/mob/?moid=SessionManager&method=cloneSession) only leads to the same error:

key "vim.fault.InvalidLoginWithReason"
message "Login failed because the session could not be re-registered."

At this point I spent a lot of time into the troubleshooting and I have no idea why the clone operation doesnt work. I can't find anything via Google about this "re-registered" error. Did I miss something? Are there any special reqirements? Can sombody please give me a hint how I can succesfully clone the session?


Best regards,

Martin

0 Kudos
3 Replies
Plam_Dimitrov
VMware Employee
VMware Employee

Hi Martin,

It seems like you are using an already logged-in vim port. I tried it locally - first login via username/password and then cloning the session via ticket on the same vim port and got the same error as you. Can you try with a non logged-in vim port instead (e.g. the way it's demonstrated in the remote plugin sample)?

Cheers,

Plam

0 Kudos
ZD14a
Contributor
Contributor

Hi Plam,

Thank you for your input. Indeed, I use a logged in VIM-Session. In the example they use the Java SDK, which allows to get the Session Manager without logging in. In my case I have to use the Perl SDK and there I didn't find a way to get a SessionManager Object without logging in.

What I do now is to use an unprivileged service account to log in at the vCenter, get the SessionManager Object, logout and then use the logged out SessionManager object to clone the session.

 

my $sessionManager = $vimSession->get_view(mo_ref => $vimSession->get_service_content()->sessionManager);
$sessionManager->Logout();
my $returnSession = $sessionManager->CloneSession(cloneTicket => $cloneTicket);

 

And this finally works for me. Is it a good solution? I don't know, but it's the only one I found. Does anyone know how to reach this with the Perl SDK without logging in before?

 

Best regards,

Martin

0 Kudos
stoevm
VMware Employee
VMware Employee

Moving this to the vSphere SDK for Perl Discussions for better resolution.

0 Kudos