Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 894027 - PRD35 - [RFE] [restapi] Display the current logged in user in API
PRD35 - [RFE] [restapi] Display the current logged in user in API
Status: CLOSED ERRATA
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.1.0
Unspecified Unspecified
high Severity medium
: ---
: 3.5.0
Assigned To: Ori Liel
Pavel Novotny
infra
: FutureFeature
: 987546 (view as bug list)
Depends On:
Blocks: 1120931 rhev3.5beta 1156165
  Show dependency treegraph
 
Reported: 2013-01-10 09:49 EST by Dan Yasny
Modified: 2016-02-10 14:20 EST (History)
17 users (show)

See Also:
Fixed In Version: ovirt-3.5.0-alpha1
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-02-11 12:51:18 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
sherold: Triaged+


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


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

  None (edit)
Description Dan Yasny 2013-01-10 09:49:09 EST
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 09:55:31 EST
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 10:41:23 EST
(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 10:51:45 EST
(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-23 23:46:36 EDT
*** Bug 987546 has been marked as a duplicate of this bug. ***
Comment 10 Ori Liel 2014-03-19 08:40:14 EDT
patch posted: 

  http://gerrit.ovirt.org/#/c/25591/
Comment 11 Pavel Novotny 2014-06-13 10:00:22 EDT
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 10:01:04 EDT
Created attachment 908588 [details]
FailedQA - server.log with a traceback
Comment 13 Juan Hernández 2014-06-20 11:09:47 EDT
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 10:12:57 EDT
patch posted: 
 
   http://gerrit.ovirt.org/#/c/29506/1
Comment 15 Ori Liel 2014-07-02 10:14:01 EDT
patch merged
Comment 16 Ori Liel 2014-07-02 10:25:45 EDT
for 3.5 branch: 
  
  http://gerrit.ovirt.org/#/c/29515/
Comment 17 Michal Skrivanek 2014-07-02 10:27:54 EDT
should be modified only once 29515 gets merged:-)
Comment 18 Oved Ourfali 2014-07-07 08:54:29 EDT
Branching will be done again tomorrow, so moving to MODIFIED
Comment 21 Pavel Novotny 2014-12-05 07:49:00 EST
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@domain.example.com
3. Open the VM console and log into guest as user john@vm-1.rhevm.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@vm-1.rhevm.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 12:51:18 EST
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.