[ovirt-users] Python-SDK4: How to list VM user sessions?

Juan Hernández jhernand at redhat.com
Thu Mar 30 18:05:05 UTC 2017


On 03/30/2017 01:01 PM, Giulio Casella wrote:
> Hi,
> I'm trying to obtain a list of users connected to a VM, using python SDK
> v4.
> Here's what I'm doing:
> 
> vm = vms_service.list(search="name=vmname")[0]
> vm_service = vms_service.vm_service(vm.id)
> sessions = vm_service.sessions_service().list()
> 
> But "sessions" is None.
> 
> Same result using:
> 
> s = connection.follow_link(vm.sessions)
> 
> "s" is None.
> 
> I tried also using curl, and if I connect to:
> 
> https://my.ovirt.host/ovirt-engine/api/v4/vms/<vmid>/sessions
> 
> I get a beautiful 404.
> 
> Also using v3 of python SDK I obtain the same behaviour.
> 
> So I suspect that retrieving user sessions via API is not implemented,
> is it? If not, what I'm doing wrong?
> 
> I'm using RHV 4.0.6.3-0.1.el7ev
> 
> Thanks in advance,
> Giulio
> 

Giulio, you should never get a 404 error from that URL, unless the
virtual doesn't exist or isn't visible for you. What user name are you
to create the SDK connection? An administrator or a regular user?

Also, please check the /var/log/ovirt-engine/server.log and
/var/log/ovirt-engine/engine.log when you send that request. Do you see
there something relevant?

Finally, please run your script with the 'debug=True' option in the
connection, and with a log file, like here:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vms.py#L20-L37

Then share that log file so that we can check what the server is
returning exactly. Make sure to remove your password from that log file
before sharing it.






More information about the Users mailing list