Bug 1408599

Summary: Cannot allocate a prestarted vm from a pool as user with permissions via API
Product: [oVirt] ovirt-engine Reporter: sefi litmanovich <slitmano>
Component: BLL.VirtAssignee: Shahar Havivi <shavivi>
Status: CLOSED CURRENTRELEASE QA Contact: sefi litmanovich <slitmano>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: bugs, tjelinek
Target Milestone: ovirt-4.1.0-rcKeywords: Automation, Regression
Target Release: 4.1.0.2Flags: rule-engine: ovirt-4.1+
rule-engine: blocker+
rule-engine: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:36:51 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:
Attachments:
Description Flags
engine log none

Description sefi litmanovich 2016-12-25 17:10:05 UTC
Created attachment 1235269 [details]
engine log

Description of problem:
When trying to take a prestarted vm from a pool via API as a user that got userRole permission on the pool, the action fails with:
Detail: [General command validation failure.]

engine.log shows a very long trace for this error:
2016-12-22 08:45:14,742+02 ERROR [org.ovirt.engine.core.bll.AttachUserToVmFromPoolAndRunCommand] (default task-4) [vmpools_syncAction_b45dcdea-fa27-4e0] Error during ValidateFailure.: java.lang.NullPointerException

We hit this issue on automation and I was able to re produce the bug on my 4.1  env manually.

The same error doesn't occur when login with the user to user portal and starting a session on the vm from there.

Version-Release number of selected component (if applicable):
ovirt-engine-4.1.0-0.2.master.20161218144454.gitbaa2853.el7.centos.noarch

How reproducible:
always

Steps to Reproduce:
1. Create a vm pool - size 1, set pre started vms in the pool to 1.
2. Add userRole permission for the pool to some user in your system, can be admin as well.
3. Wait for the prestarted vm to start.
4. Connect to API with user you gave permissions on the pool to and try to allocate a vm from the pool

POST https://{engine_url}/ovirt-engine/api/vmpools/{vmpool_id}/allocatevm

<action>
    <async>false</async>
    <grace_period>
        <expiry>10</expiry>
    </grace_period>
</action>

Actual results:
Fails with:
Detail: [General command validation failure.]

Expected results:
User starts a session on the vm and vm inherits the userRole permission for that user from the pool.

Additional info:
Attaching engine.log from automation run - look for:
'vmpools_syncAction_b45dcdea-fa27-4e0'

Comment 1 Red Hat Bugzilla Rules Engine 2017-01-03 08:45:53 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 2 sefi litmanovich 2017-01-26 11:58:50 UTC
Verified with rhevm-4.1.0.2-0.2.el7.noarch according to the steps in description.