Bug 1080029

Summary: [RFE] Need a way to determine how many days a user has been attached to a pooled VM
Product: Red Hat Enterprise Virtualization Manager Reporter: Allie DeVolder <adevolder>
Component: RFEsAssignee: Roy Golan <rgolan>
Status: CLOSED ERRATA QA Contact: Shira Maximov <mshira>
Severity: high Docs Contact:
Priority: medium    
Version: 3.3.0CC: bgraveno, gklein, iheim, istein, lpeer, michal.skrivanek, mperina, mshira, rbalakri, rgolan, sherold, yeylon
Target Milestone: ovirt-3.6.0-rcKeywords: FutureFeature
Target Release: 3.6.0Flags: sherold: Triaged+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
It is now possible to track the number of days that a user has been attached to a pooled virtual machine by inspecting the 'Creation Date' in the 'Permission' sub-tab.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-09 20:44:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Allie DeVolder 2014-03-24 14:41:12 UTC
- What is the nature and description of the request?

Customer needs a way to be able to determine how long a user has been attached to a VM in a pool. The VMs are all pre-started, so there's no easy way to tell. 

- Why does the customer need this? (List the business requirements here)

The purpose is to be able to manually shut down unused idle VMs that have been abandoned for a certain amount of time.

Additional information:
Previous bugzillas have been filed that are relevant here:
- 877207 ([RFE] allow VMs to be shut down automatically according to business rules). This bugzilla, if implemented, would automatically shut down the VMs under certain conditions. This is slightly different, in that this particular request is basically information-only, so that the VMs could be powered down manually.
- 879586 ([RFE] Display and keep track of both the client user and the in-guest session username). This bugzilla is closed-errata, and should make this easier to implement
- 883855 (Use guest agent to report logged in users) was closed as a duplicate of 879586

Comment 3 Roy Golan 2015-03-05 09:18:13 UTC
users attached to pool using permission. 

to view the duration a VM is attached to a user I'm going to nhance permissions table with creation date (seconds from epoch)

admins can inpect the permission subtab of a pool and see a new column added there with the date and duration 

something like 

 User | Auth provider | Namespace | Role     | Creation Date       | Inherited |

 Roy  | internal      | *         | UserRole | 22/11/2014 (45 days ago) |

Comment 4 Omer Frenkel 2015-03-05 11:31:32 UTC
to see how much time user(s) attached to vm you need to see this in the permissions sub tab of the vm, not the pool.
(permissions on pool is the users that can use it, permissions on the vm are the user(s) that are using the specific vm currently)

Comment 5 Roy Golan 2015-03-24 11:49:28 UTC
(In reply to Roy Golan from comment #3)
> users attached to pool using permission. 
> 
> to view the duration a VM is attached to a user I'm going to nhance
> permissions table with creation date (seconds from epoch)
> 
> admins can inpect the permission subtab of a pool and see a new column added
> there with the date and duration 
> 
> something like 
> 
>  User | Auth provider | Namespace | Role     | Creation Date       |
> Inherited |
> 
>  Roy  | internal      | *         | UserRole | 22/11/2014 (45 days ago) |

I didn't implement the "(45 days ago)" addition. just left the creation date as is.

Comment 6 Shira Maximov 2015-04-19 11:56:31 UTC
The implementation of RFE looks wrong in my opinion.
The customer wanted to know how long a user has been attached to a VM in a pool. 
In order to be able to manually shut down unused idle VMs.
The implementation here is to add the permission creation date, you can't really know from the permission creation date if the vm's aren't being used. 

Moving to PM to additional info.

Comment 7 Omer Frenkel 2015-05-12 10:48:40 UTC
(In reply to Shira Maximov from comment #6)
> The implementation of RFE looks wrong in my opinion.
> The customer wanted to know how long a user has been attached to a VM in a
> pool. 
> In order to be able to manually shut down unused idle VMs.
> The implementation here is to add the permission creation date, you can't
> really know from the permission creation date if the vm's aren't being used. 

we can't really know if vm is "being used", what exactly does it mean?

the permission create date is the date the user was attached to the vm,
so you can know how long the user is attached to the vm, and make decision according to this, which is exactly what was requested here.

what info are you missing?

Comment 8 Shira Maximov 2015-05-12 11:51:20 UTC
In my opinion you can really tell from the permission creation date if it's ok to shut down a VM.

for example, 
lets say that i have 10 VMs that i started two months ago, those VMs uses a lot resources but I didn't use those VMs during this period of time at all.
Do you think that in this case the permission creation date can help me?

Comment 9 Omer Frenkel 2015-05-13 14:47:06 UTC
don't forget we are talking about vm-pool.
so if your use case is that users usually take vms, use it for a week, and then return it (lets say you are running a 1-week course cycles in some university), but here you notice vm that is assigned to a user for 2 months (looking at the permission date), then its suspicious/irregular and you need to investigate with the user of this vm what is going on and act..

this was (for my understanding) the nature of the request here, and not about cpu/memory/network/storage/.. usage.

Comment 10 Ilanit Stein 2015-05-26 14:01:18 UTC
Scott, 

would you please take a look at comments #6-9?
Is the implementation seem OK, or mismatch the customer needs?

Comment 11 Scott Herold 2015-06-02 15:55:46 UTC
Following a conversation, I understand the following about this RFE and proposed solution:

* We are tracking when a user is assigned a VM from the pool based on the timestamp of when the permission was assigned to the user.

* If a user disconnects from the VM and no longer needs the session, the VM is powered off, and has no permissions assigned in that state

* The only way it is possible to have Powered On VMs without a user permission is from the pre-configured Powered On VMs pool, which are explicitly configured by the user

* The only thing we can tell the user effectively is that: "User foo was assigned to VM bar 45 days ago".

* The end user will need to determine a trigger based on the available data as to what normal/abnormal behavior is.  (ie: User foo has been logged in to VM bar for 45 days, that seems like a REALLY long time.  I need to check if VM bar is still actively in use.

Omer/Ilanit, please verify I do not misunderstand current status/design?

Comment 12 Omer Frenkel 2015-06-03 07:41:01 UTC
sounds right to me.
just a little note, to be 100% accurate, another option to have a pool-vm up and not assigned to a user, beside setting the 'pre-started' is if the administrator manually start it from the web-admin (in contrary to users that "take" pool-vms in the user-portal)

Comment 13 Ilanit Stein 2015-06-08 05:35:12 UTC
We've (me & Shira) discussed with Omer, and we understand the limitation of not being able to actually determine how many days a user has been attached to a pooled VM,
Displaying the information of when permissions were given to a user, seems the best effort that can be done here.

Comment 14 Ilanit Stein 2015-06-08 12:08:29 UTC
Correction to comment #13: 
 
Instead of:
limitation of not being able to actually determine how many days a user has been attached to a pooled VM

should be:

limitation of not being able to actually determine how many days a user has been using a pooled VM

Comment 17 Shira Maximov 2015-10-19 14:56:14 UTC
verify on the following version: 
Red Hat Enterprise Virtualization Manager Version: 3.6.0.1-0.1.el6


link to test run: https://polarion.engineering.redhat.com/polarion/#/project/RHEVM3/testruns

Comment 19 errata-xmlrpc 2016-03-09 20:44:13 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/RHEA-2016-0376.html