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

Giulio Casella giulio at di.unimi.it
Thu Mar 30 12:25:32 UTC 2017


On 30/03/2017 13:39, nicolas at devels.es wrote:
> Hi Giulio,
>
> I tried to reproduce your same steps and it returns an non-empty list
> for me.
>
> In [1]: vms_serv = sys_serv.vms_service()
>
> In [2]: vm = vms_serv.list(search='name=bleh')[0]
>
> In [3]: vmsv = vms_serv.vm_service(vm.id)
>
> In [4]: vmsess = vmsv.sessions_service()
>
> In [5]: vmsess.list()
> Out[5]:
> [<ovirtsdk4.types.Session at 0x4701e10>,
>  <ovirtsdk4.types.Session at 0x4701e90>]
>
> Are you sure a session is initiated on vmname in the moment you run the
> vms_service.list(...)[0] statement?

Yes, if I print vm I obtain:

<ovirtsdk4.types.Vm object at 0x15dcb10>

while if I print vm_service:

VmService:/vms/<vmid>

and it is a real service (e.g. I can call method start, shutdown, ...)



>
> El 2017-03-30 12:01, Giulio Casella escribió:
>> 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
>>
>> _______________________________________________
>> Users mailing list
>> Users at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users

-- 
Giulio Casella                                    giulio at di.unimi.it
System and network manager
Computer Science Dept. - University of Milano


More information about the Users mailing list