Bug 894027 - PRD35 - [RFE] [restapi] Display the current logged in user in API
Summary: PRD35 - [RFE] [restapi] Display the current logged in user in API
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: 3.5.0
Assignee: Ori Liel
QA Contact: Pavel Novotny
URL:
Whiteboard: infra
: 987546 (view as bug list)
Depends On:
Blocks: 1120931 rhev3.5beta 1156165
TreeView+ depends on / blocked
 
Reported: 2013-01-10 14:49 UTC by Dan Yasny
Modified: 2018-12-09 16:54 UTC (History)
17 users (show)

Fixed In Version: ovirt-3.5.0-alpha1
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-11 17:51:18 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:
sherold: Triaged+


Attachments (Terms of Use)
FailedQA - server.log with a traceback (5.25 KB, text/x-log)
2014-06-13 14:01 UTC, Pavel Novotny
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0158 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Virtualization Manager 3.5.0 2015-02-11 22:38:50 UTC
oVirt gerrit 25591 0 None None None Never
oVirt gerrit 29506 0 master MERGED restapi - Fix Display VM Session Info (#894027) Never
oVirt gerrit 29515 0 ovirt-engine-3.5 ABANDONED restapi - Fix Display VM Session Info (#894027) Never

Description Dan Yasny 2013-01-10 14:49:09 UTC
Description of problem:
guest_cur_user_name from vm_dynamic should show up in the API

since Bug 873790 is already requesting additional params, that Bug 879586 will provide in 3.2, I suggest the following:

<vm>
...
  <session>
    <logged_in_user>username</logged_in_user>
    <session_user>username</session_user>
    <client_ip>ip</client_ip>
  </session>
...
</vm>

Comment 1 Dan Yasny 2013-01-10 14:55:31 UTC
In addition, Bug 879586 will provide an additional user field, we'll have the in-guest user and the RHEV user that opened the spice console, we need both of them in the API

Comment 2 Itamar Heim 2013-01-10 15:41:23 UTC
(In reply to comment #0)
> Description of problem:
...
> ...
>   <session>
>     <logged_in_user>username</logged_in_user>
>     <session_user>username</session_user>
>     <client_ip>ip</client_ip>
>   </session>

i thought the intention is to report more than a single user going forward?

Comment 3 Dan Yasny 2013-01-10 15:51:45 UTC
(In reply to comment #2)
> 
> i thought the intention is to report more than a single user going forward?

  <session>
    <logged_in_user>username</logged_in_user>
    <logged_in_user>username</logged_in_user>
    <logged_in_user>username</logged_in_user>
...
    <logged_in_user>usernameN</logged_in_user>
    <session_user>username</session_user>
    <client_ip>ip</client_ip>
  </session>

Comment 7 Itamar Heim 2013-07-24 03:46:36 UTC
*** Bug 987546 has been marked as a duplicate of this bug. ***

Comment 10 Ori Liel 2014-03-19 12:40:14 UTC
patch posted: 

  http://gerrit.ovirt.org/#/c/25591/

Comment 11 Pavel Novotny 2014-06-13 14:00:22 UTC
FailedQA in ovirt-engine-3.5.0-0.0.master.20140605145557.git3ddd2de.el6.noarch (alpha2).

Verification steps:
1. Have a VM with  guest agent installed (I used Fedora 19).
2. Open VM console and log into the system.
3. In browser/REST API client get resource /ovirt-engine/api/vms/<vm-uuid>/sessions

Result: 
HTTP 404:
-~-
HTTP Status 404 -

type Status report

message

description The requested resource () is not available.
JBoss Web/7.0.13.Final
-~-
Plus a traceback in server.log (attaching in next comment).

Expected result:
XML response with VM sessions collection.

Notes:
Webadmin shows the logged-in user correctly.

Comment 12 Pavel Novotny 2014-06-13 14:01:04 UTC
Created attachment 908588 [details]
FailedQA - server.log with a traceback

Comment 13 Juan Hernández 2014-06-20 15:09:47 UTC
Currently this fails because we are trying to find the user using something like "admin@internal" as the key to lookup the users table, but the "username" column of this table only contains "admin" now. The "internal" part is in the column "domain".

Also, when creating the XML representation we are putting the login name of the user in the "name" element, but it should instead go in "user_name".

Comment 14 Ori Liel 2014-07-02 14:12:57 UTC
patch posted: 
 
   http://gerrit.ovirt.org/#/c/29506/1

Comment 15 Ori Liel 2014-07-02 14:14:01 UTC
patch merged

Comment 16 Ori Liel 2014-07-02 14:25:45 UTC
for 3.5 branch: 
  
  http://gerrit.ovirt.org/#/c/29515/

Comment 17 Michal Skrivanek 2014-07-02 14:27:54 UTC
should be modified only once 29515 gets merged:-)

Comment 18 Oved Ourfali 2014-07-07 12:54:29 UTC
Branching will be done again tomorrow, so moving to MODIFIED

Comment 21 Pavel Novotny 2014-12-05 12:49:00 UTC
Verified in rhevm-3.5.0-0.23.beta.el6ev.noarch (vt13.1).

Verification steps:
1. Have a running VM with guest agent installed.
2. Log into RHEVM as domain user user1.com
3. Open the VM console and log into guest as user john.example.com

The API response for /ovirt-engine/api/vms/<vm-id>/sessions/ is following:
-~-
<sessions>
  <session href="..." id="...">
    <vm href="..." id="..."/>
    <ip address="..."/>
    <user href="..." id="...">
      <domain href="..." id="...">
        <name>domain.example.com</name>
      </domain>
      <user_name>user1</user_name>
    </user>
  <console_user>true</console_user>
  </session>
  <session href="..." id="...">
    <vm href="..." id="..."/>
    <user>
      <user_name>john.example.com</user_name>
    </user>
  </session>
</sessions>
-~-

There are two sessions:
- first session (with attr. <console_user>true</console_user>) is present only if the VM console is opened by RHEVM user
- second session contains name of the user, which is currently logged into the guest; if no guest user is logged in, the user_name value is None

Comment 23 errata-xmlrpc 2015-02-11 17:51:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0158.html


Note You need to log in before you can comment on or make changes to this bug.