
2016-02-11 12:59 GMT+01:00 Richard W.M. Jones <rjones@redhat.com>:
Is calling SessionIsActive necessary? From my (very limited) understanding, it seems as if we might use 'SessionManager. currentSession' property instead, which doesn't require admin permissions. Actually the code [see link above] already does this when ctx->hasSessionIsActive is false, but that doesn't apply to modern vCenter.
SessionIsActive Is not necessary here, but it seemed to be the better solution compared to this more hacky way of checking session object. I wasn't aware that is would require admin level privileges.
Also, why is it even necessary to check if the session is active here? Shouldn't we just log in unconditionally?
This was done a long time ago, I don't remember all the details, but the gist of it goes like this: The login session will expire after some idle time. I'm not sure if an expired session could be detected from the server responses at all or if it was just too difficult to integrated it that way. Anyway, I ended up checking if the login session was still good and re-login if it wasn't at the start of every libvirt driver function. The driver could probably login at the start of each libvirt driver function and logout at the end, completely avoiding the issue of idling login session. On the other hand that would be a major chance in the way the driver works. So I'm not tempted to chance stuff like this now and am going to play it save. As said before, SessionIsActive was used because it seemed to be the right thing to do and I wasn't aware of the consequences at the time. Here's a patch that basically reverts the offending commit. The patch is only compile tested, as I don't have a vCenter at hand to test this. Do you have the option to test this in an actual setup? -- Matthias Bolte http://photron.blogspot.com