Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On 10/04/2017 17:50, Juan Hernández wrote: On 04/10/2017 05:38 PM, Giorgio Biacchi wrote: ... OK, that makes sense. I think this is a bug in the server then. If the users are not oVirt users we should just not report them, or maybe report just the user name and domain, if available. But returning 404 and failing in that case isn't correct, in my opinion. I have opened the following bug to track this issue: Don't fail with 404 if session user doesn't exist in the database https://bugzilla.redhat.com/1440861 Great, thank you Juan. My preference is for reporting username and domain, instead of not reporting at all. Thank you again. Bye, Giulio On 04/10/2017 01:18 PM, Juan Hernández wrote: On 04/10/2017 11:10 AM, Giulio Casella wrote: On 07/04/2017 16:00, Juan Hernández wrote: I have been trying to reproduce this and I wasn't able. In theory the 404 error that you get should only happen if the virtual machine doesn't exist, but that isn't the case. Can you check the server.log file and share the complete stack traces that should appear after the "HTTP 404 Not Found" message? No problem, find attached a snippet of server.log. Bye, Giulio Thanks, that helps. What the engine isn't finding is the user, not the virtual machine. Can you provide more information about that user? I mean, take the virtual machine and find via the GUI which user is using it. Then go to https://.../ovirt-engine/api/users and find that user. Share the definition of that user that you get there, if possible. On 03/31/2017 10:25 AM, Giulio Casella wrote: On 30/03/2017 20:05, Juan Hernández wrote: 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//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? I tried with a regular domain user (with superuser role assigned) and admin@internal, with same result. 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? server.log reports: 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-33) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: HTTP 404 Not Found (no surprise here, same message obtained by curl). engine.log is full of: ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default task-7) [] Cannot authenticate using authentication Headers: invalid_grant: The provided authorization grant for the auth code has expired (indipendently of my request) It's quite strange I can perform almost every other operation (e.g. getting other VM parameters, running methods, etc.) 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. Find attached produced log (passwords purged). BTW: VM is a Fedora 24, with guest agents correctly installed (I can see user sessions in admin portal and in postgresql DB). Thanks, Giulio ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On 04/10/2017 05:38 PM, Giorgio Biacchi wrote: > Hi, > I'm taking over Giulio because he's not at work now. I'm starting to > understand what's happening because we have not that users (and many > others) in the users tab in the admin portal. > > We have heavily modified the paradigm of ovirt, VM are bound to thin > clients and not to users, this because we want to reproduce a > lab/classroom environment and we don't use the user portal. We wrote an > alternative administration portal where we define classrooms, thin > clients and associations between clients and VMs. > > Windows VMs are joined to a AD domain and linux VMs are joined to IPA, > home dirs are remotely mounted upon user login. > > So there's no need to have all that users (over 31000) in the admin > portal because they have no permission on any VM, they can login from > any client to the VM bound to that client. > > In the admin portal, if I go to a VM with a logged in user in the "Guest > info" tab I can see which user is logged in because, I think, the guest > agents are aware of the logged in username, but there's no "user object" > in the engine when I try to get that information via API. > > Thanks for your time and patience.. > > Regards, > Giorgio > OK, that makes sense. I think this is a bug in the server then. If the users are not oVirt users we should just not report them, or maybe report just the user name and domain, if available. But returning 404 and failing in that case isn't correct, in my opinion. I have opened the following bug to track this issue: Don't fail with 404 if session user doesn't exist in the database https://bugzilla.redhat.com/1440861 > On 04/10/2017 01:18 PM, Juan Hernández wrote: >> On 04/10/2017 11:10 AM, Giulio Casella wrote: >>> On 07/04/2017 16:00, Juan Hernández wrote: I have been trying to reproduce this and I wasn't able. In theory the 404 error that you get should only happen if the virtual machine doesn't exist, but that isn't the case. Can you check the server.log file and share the complete stack traces that should appear after the "HTTP 404 Not Found" message? >>> >>> No problem, find attached a snippet of server.log. >>> >>> Bye, >>> Giulio >>> >> >> Thanks, that helps. What the engine isn't finding is the user, not the >> virtual machine. Can you provide more information about that user? I >> mean, take the virtual machine and find via the GUI which user is using >> it. Then go to https://.../ovirt-engine/api/users and find that user. >> Share the definition of that user that you get there, if possible. >> On 03/31/2017 10:25 AM, Giulio Casella wrote: > On 30/03/2017 20:05, Juan Hernández wrote: >> 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//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? >> > > I tried with a regular domain user (with superuser role assigned) and > admin@internal, with same result. > >> 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? > > server.log reports: > > 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] > (default task-33) RESTEASY002010: Failed to execute: > javax.ws.rs.WebApplicationException: HTTP 404 Not Found > > (no surprise here, same message obtained by curl). > > engine.log is full of: > > ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] > (default > task-7) [] Cannot authenticate using authentication Headers: > invalid_grant: The provided authorization grant for the auth code has > expired > > (indipendently of my request) > > It's quite strange I can perform almost every other operation (e.g.
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
Hi, I'm taking over Giulio because he's not at work now. I'm starting to understand what's happening because we have not that users (and many others) in the users tab in the admin portal. We have heavily modified the paradigm of ovirt, VM are bound to thin clients and not to users, this because we want to reproduce a lab/classroom environment and we don't use the user portal. We wrote an alternative administration portal where we define classrooms, thin clients and associations between clients and VMs. Windows VMs are joined to a AD domain and linux VMs are joined to IPA, home dirs are remotely mounted upon user login. So there's no need to have all that users (over 31000) in the admin portal because they have no permission on any VM, they can login from any client to the VM bound to that client. In the admin portal, if I go to a VM with a logged in user in the "Guest info" tab I can see which user is logged in because, I think, the guest agents are aware of the logged in username, but there's no "user object" in the engine when I try to get that information via API. Thanks for your time and patience.. Regards, Giorgio On 04/10/2017 01:18 PM, Juan Hernández wrote: On 04/10/2017 11:10 AM, Giulio Casella wrote: On 07/04/2017 16:00, Juan Hernández wrote: I have been trying to reproduce this and I wasn't able. In theory the 404 error that you get should only happen if the virtual machine doesn't exist, but that isn't the case. Can you check the server.log file and share the complete stack traces that should appear after the "HTTP 404 Not Found" message? No problem, find attached a snippet of server.log. Bye, Giulio Thanks, that helps. What the engine isn't finding is the user, not the virtual machine. Can you provide more information about that user? I mean, take the virtual machine and find via the GUI which user is using it. Then go to https://.../ovirt-engine/api/users and find that user. Share the definition of that user that you get there, if possible. On 03/31/2017 10:25 AM, Giulio Casella wrote: On 30/03/2017 20:05, Juan Hernández wrote: 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//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? I tried with a regular domain user (with superuser role assigned) and admin@internal, with same result. 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? server.log reports: 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-33) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: HTTP 404 Not Found (no surprise here, same message obtained by curl). engine.log is full of: ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default task-7) [] Cannot authenticate using authentication Headers: invalid_grant: The provided authorization grant for the auth code has expired (indipendently of my request) It's quite strange I can perform almost every other operation (e.g. getting other VM parameters, running methods, etc.) 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. Find attached produced log (passwords purged). BTW: VM is a Fedora 24, with guest agents correctly installed (I can see user sessions in admin portal and in postgresql DB). Thanks, Giulio ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- gb PGP Key: http://pgp.mit.edu/ Primary key fingerprint: C510 0765 943E EBED A4F2 69D3 16CC DC90 B9CB 0F34 ___ Users mailing list Users@ovirt.org
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On 04/10/2017 11:10 AM, Giulio Casella wrote: > On 07/04/2017 16:00, Juan Hernández wrote: >> I have been trying to reproduce this and I wasn't able. In theory the >> 404 error that you get should only happen if the virtual machine doesn't >> exist, but that isn't the case. >> >> Can you check the server.log file and share the complete stack traces >> that should appear after the "HTTP 404 Not Found" message? >> > > No problem, find attached a snippet of server.log. > > Bye, > Giulio > Thanks, that helps. What the engine isn't finding is the user, not the virtual machine. Can you provide more information about that user? I mean, take the virtual machine and find via the GUI which user is using it. Then go to https://.../ovirt-engine/api/users and find that user. Share the definition of that user that you get there, if possible. >> On 03/31/2017 10:25 AM, Giulio Casella wrote: >>> On 30/03/2017 20:05, Juan Hernández wrote: 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//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? >>> >>> I tried with a regular domain user (with superuser role assigned) and >>> admin@internal, with same result. >>> 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? >>> >>> server.log reports: >>> >>> 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] >>> (default task-33) RESTEASY002010: Failed to execute: >>> javax.ws.rs.WebApplicationException: HTTP 404 Not Found >>> >>> (no surprise here, same message obtained by curl). >>> >>> engine.log is full of: >>> >>> ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default >>> task-7) [] Cannot authenticate using authentication Headers: >>> invalid_grant: The provided authorization grant for the auth code has >>> expired >>> >>> (indipendently of my request) >>> >>> It's quite strange I can perform almost every other operation (e.g. >>> getting other VM parameters, running methods, etc.) >>> >>> 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. >>> Find attached produced log (passwords purged). >>> >>> BTW: VM is a Fedora 24, with guest agents correctly installed (I can see >>> user sessions in admin portal and in postgresql DB). >>> >>> Thanks, >>> Giulio >>> >>> >>> >>> ___ >>> Users mailing list >>> Users@ovirt.org >>> http://lists.ovirt.org/mailman/listinfo/users >>> >> > ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On 07/04/2017 16:00, Juan Hernández wrote: I have been trying to reproduce this and I wasn't able. In theory the 404 error that you get should only happen if the virtual machine doesn't exist, but that isn't the case. Can you check the server.log file and share the complete stack traces that should appear after the "HTTP 404 Not Found" message? No problem, find attached a snippet of server.log. Bye, Giulio On 03/31/2017 10:25 AM, Giulio Casella wrote: On 30/03/2017 20:05, Juan Hernández wrote: 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//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? I tried with a regular domain user (with superuser role assigned) and admin@internal, with same result. 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? server.log reports: 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-33) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: HTTP 404 Not Found (no surprise here, same message obtained by curl). engine.log is full of: ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default task-7) [] Cannot authenticate using authentication Headers: invalid_grant: The provided authorization grant for the auth code has expired (indipendently of my request) It's quite strange I can perform almost every other operation (e.g. getting other VM parameters, running methods, etc.) 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. Find attached produced log (passwords purged). BTW: VM is a Fedora 24, with guest agents correctly installed (I can see user sessions in admin portal and in postgresql DB). Thanks, Giulio ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users 2017-04-10 10:51:48,353 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-30) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: HTTP 404 Not Found at org.ovirt.engine.api.restapi.resource.BaseBackendResource.handleError(BaseBackendResource.java:226) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendResource.getEntity(BackendResource.java:118) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendResource.getEntity(BackendResource.java:98) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.AbstractBackendSubResource.performGet(AbstractBackendSubResource.java:34) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.aaa.BackendUserResource.getUserByNameAndDomain(BackendUserResource.java:77) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendVmSessionsResource.setSessionUser(BackendVmSessionsResource.java:87) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendVmSessionsResource.addLinksIncludingUser(BackendVmSessionsResource.java:59) [restapi-jaxrs.jar:] at org.ovirt.engine.api.restapi.resource.BackendVmSessionsResource.list(BackendVmSessionsResource.java:42) [restapi-jaxrs.jar:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_121] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139) [resteasy-jaxrs.jar:3.0.19.Final-redhat-1] at
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
I have been trying to reproduce this and I wasn't able. In theory the 404 error that you get should only happen if the virtual machine doesn't exist, but that isn't the case. Can you check the server.log file and share the complete stack traces that should appear after the "HTTP 404 Not Found" message? On 03/31/2017 10:25 AM, Giulio Casella wrote: > On 30/03/2017 20:05, Juan Hernández wrote: >> 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//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? >> > > I tried with a regular domain user (with superuser role assigned) and > admin@internal, with same result. > >> 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? > > server.log reports: > > 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] > (default task-33) RESTEASY002010: Failed to execute: > javax.ws.rs.WebApplicationException: HTTP 404 Not Found > > (no surprise here, same message obtained by curl). > > engine.log is full of: > > ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default > task-7) [] Cannot authenticate using authentication Headers: > invalid_grant: The provided authorization grant for the auth code has > expired > > (indipendently of my request) > > It's quite strange I can perform almost every other operation (e.g. > getting other VM parameters, running methods, etc.) > > >> >> 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. >> > Find attached produced log (passwords purged). > > BTW: VM is a Fedora 24, with guest agents correctly installed (I can see > user sessions in admin portal and in postgresql DB). > > Thanks, > Giulio > > > > ___ > Users mailing list > Users@ovirt.org > http://lists.ovirt.org/mailman/listinfo/users > ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On 30/03/2017 20:05, Juan Hernández wrote: 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//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? I tried with a regular domain user (with superuser role assigned) and admin@internal, with same result. 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? server.log reports: 2017-03-31 10:03:11,346 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-33) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: HTTP 404 Not Found (no surprise here, same message obtained by curl). engine.log is full of: ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default task-7) [] Cannot authenticate using authentication Headers: invalid_grant: The provided authorization grant for the auth code has expired (indipendently of my request) It's quite strange I can perform almost every other operation (e.g. getting other VM parameters, running methods, etc.) 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. Find attached produced log (passwords purged). BTW: VM is a Fedora 24, with guest agents correctly installed (I can see user sessions in admin portal and in postgresql DB). Thanks, Giulio DEBUG:root:About to connect() to rhev-manager.unicloudidattica.unimi.it port 443 (#0) DEBUG:root:Trying 172.21.250.100... DEBUG:root:Connected to rhev-manager.unicloudidattica.unimi.it (172.21.250.100) port 443 (#0) DEBUG:root:Initializing NSS with certpath: sql:/etc/pki/nssdb DEBUG:root:skipping SSL peer certificate verification DEBUG:root:SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 DEBUG:root:Server certificate: DEBUG:root:subject: CN=rhev-manager.unicloudidattica.unimi.it,OU=Servizio UniCloud,O=Università degli Studi di Milano,L=MIlano,ST=Milano,C=IT DEBUG:root:start date: Jan 03 00:00:00 2017 GMT DEBUG:root:expire date: Jan 08 12:00:00 2020 GMT DEBUG:root:common name: rhev-manager.unicloudidattica.unimi.it DEBUG:root:issuer: CN=TERENA SSL CA 3,O=TERENA,L=Amsterdam,ST=Noord-Holland,C=NL DEBUG:root:POST /ovirt-engine/sso/oauth/token HTTP/1.1 DEBUG:root:Host: rhev-manager.unicloudidattica.unimi.it DEBUG:root:User-Agent: PythonSDK/4.0.4 DEBUG:root:Accept: application/json DEBUG:root:Content-Length: 93 DEBUG:root:Content-Type: application/x-www-form-urlencoded DEBUG:root:username=admin%40internal=ovirt-app-api=mypasswordhere_type=password DEBUG:root:upload completely sent off: 93 out of 93 bytes DEBUG:root:HTTP/1.1 200 OK DEBUG:root:Date: Fri, 31 Mar 2017 08:14:26 GMT DEBUG:root:Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips DEBUG:root:Added cookie locale="en_US" for domain rhev-manager.unicloudidattica.unimi.it, path /, expire 3638431713 DEBUG:root:Set-Cookie: locale=en_US; path=/; HttpOnly; Max-Age=2147483647; Expires=Wed, 18-Apr-2085 11:28:33 GMT DEBUG:root:X-XSS-PROTECTION: 1; MODE=BLOCK DEBUG:root:X-CONTENT-TYPE-OPTIONS: NOSNIFF DEBUG:root:X-FRAME-OPTIONS: SAMEORIGIN DEBUG:root:Content-Type: application/json DEBUG:root:Content-Length: 278 DEBUG:root:Vary: Accept-Encoding DEBUG:root: DEBUG:root:{"access_token":"lCVRqJmXd03jpEMvrFjCQ2X-pCeC_VH1j0MncOUdg__Ph-CYX6hkxlIVcj18kjIc9fSPenwoTUzisymf_Y584g","scope":"ovirt-app-api ovirt-ext=token-info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token-info:validate","exp":"1491552866000","token_type":"bearer"} DEBUG:root:Connection #0 to host rhev-manager.unicloudidattica.unimi.it left intact DEBUG:root:Found bundle for host rhev-manager.unicloudidattica.unimi.it: 0x208c2d0 DEBUG:root:Re-using existing connection! (#0) with host rhev-manager.unicloudidattica.unimi.it DEBUG:root:Connected to rhev-manager.unicloudidattica.unimi.it (172.21.250.100) port 443 (#0)
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
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//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. ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On Thu, Mar 30, 2017 at 2:25 PM, Giulio Casellawrote: > On 30/03/2017 13:39, nico...@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]: >> [, >> ] >> >> 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: > > > > while if I print vm_service: > > VmService:/vms/ > > 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//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? >>> >> Works OK for me: In [12]: vm_service = vms_service.vm_service('55095f91-e8e3-4634-9d05-47e0cc91e66b') In [13]: vm_service.sessions_service().list() Out[13]: [] In [14]: sdk.version.VERSION Out[14]: '4.0.4' What is the version of the SDK you are using? > >>> I'm using RHV 4.0.6.3-0.1.el7ev >>> >>> Thanks in advance, >>> Giulio >>> >>> ___ >>> Users mailing list >>> Users@ovirt.org >>> http://lists.ovirt.org/mailman/listinfo/users >>> >> ___ >> Users mailing list >> Users@ovirt.org >> http://lists.ovirt.org/mailman/listinfo/users >> > > -- > Giulio Casellagiulio at di.unimi.it > System and network manager > Computer Science Dept. - University of Milano > > ___ > Users mailing list > Users@ovirt.org > http://lists.ovirt.org/mailman/listinfo/users > ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
On 30/03/2017 13:39, nico...@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]: [, ] 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: while if I print vm_service: VmService:/vms/ 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//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@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users -- Giulio Casellagiulio at di.unimi.it System and network manager Computer Science Dept. - University of Milano ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
Re: [ovirt-users] Python-SDK4: How to list VM user sessions?
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]: [, ] Are you sure a session is initiated on vmname in the moment you run the vms_service.list(...)[0] statement? 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//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@ovirt.org http://lists.ovirt.org/mailman/listinfo/users ___ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
[ovirt-users] Python-SDK4: How to list VM user sessions?
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//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@ovirt.org http://lists.ovirt.org/mailman/listinfo/users