Bug 864438 - user cannnot take a vm from pool via restapi
Summary: user cannnot take a vm from pool via restapi
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Michael Pasternak
QA Contact: Barak Dagan
URL:
Whiteboard: virt
: 862208 862791 (view as bug list)
Depends On: 862208
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-09 12:30 UTC by Michael Pasternak
Modified: 2018-11-30 21:16 UTC (History)
12 users (show)

Fixed In Version: si21
Doc Type: Bug Fix
Doc Text:
Clone Of: 862208
Environment:
Last Closed: 2012-12-04 20:00:26 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine.log (45.36 KB, text/x-log)
2012-10-18 21:13 UTC, Ondra Machacek
no flags Details

Description Michael Pasternak 2012-10-09 12:30:54 UTC
+++ This bug was initially created as a clone of Bug #862208 +++

Description of problem: user cannnot create ticket for a machine from pool


Version-Release number of selected component (if applicable):
component: ovirt-engine-restapi
version: 3.1.0 beta2 

How reproducible: always


Steps to Reproduce:
1. grant user rights on pool
2. use restapi (with userlogin) to see on which pools user has rights. 
2. use restapi to take a vm from pool

  
Actual results: this is not implemented or documented.

Expected results: This should be possible because this is possible in userportal.


Additional info: The restapi is missing the possibility to "take vm" which is usually done in userportal. Now it is not possible to use restapi to connect to a machine from a pool.

--- Additional comment from pvogel on 2012-10-02 06:05:58 EDT ---

bug should be in:
Product: Red Hat Enterprise Virtualization Manager
component: ovirt-engine-restapi

But I cann't move this bug.

--- Additional comment from mpastern on 2012-10-02 06:24:38 EDT ---

Hi Pieter,

Can you please post request you have used against api and engine log?

--- Additional comment from pvogel on 2012-10-02 07:41:16 EDT ---

That is the problem. This is not possible via restapi.

In the userportal a user can click on a pool to get a vm from that pool (take vm)
then the userportal shows a machine from that pool (eg pool-01)
then the user can click on that machine for a spice-connection.

Via restapi we try it as follows:

get as user a list of vm's
This results in a list of vm's the user has rights on. but their is no pool visible. and of course we don't have a possibility to "take a vm" and give user rights on a vm from a pool.


What we are missing in restapi:

1) howto see via restapi that a user has a userrole on a pool
2) take a vm from a pool (if a user didn't already have one)

--- Additional comment from iheim on 2012-10-03 15:43:21 EDT ---

indeed.
the rest api was originally developed for admins, and pool 'allocate' wasn't relevant for admins.
now that user api was added, it was basedon the admin api, which didn't have this verb which should be added.

http://lists.ovirt.org/pipermail/engine-devel/2012-October/002572.html

Comment 1 Michael Pasternak 2012-10-09 13:39:50 UTC
*** Bug 862208 has been marked as a duplicate of this bug. ***

Comment 2 Michael Pasternak 2012-10-10 08:26:55 UTC
*** Bug 862791 has been marked as a duplicate of this bug. ***

Comment 3 Michael Pasternak 2012-10-11 08:38:14 UTC
http://gerrit.ovirt.org/#/c/8488/

Comment 4 Michael Pasternak 2012-10-11 08:39:37 UTC
implemented as:

POST /api/vmpools/{vmpool:id}/allocatevm

<action/>

Comment 6 Ondra Machacek 2012-10-18 21:13:48 UTC
Created attachment 629652 [details]
engine.log

Doesn't work for me.

run:
curl -k -X POST -H "Accept: application/xml" -H "Content-Type: application/xml"
    -d "<action/>" \
    -u $U $URL/vmpools/pool-id/allocatevm

get:
<action>
    <vm href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde" id="1eef4b1b-d558-465b-bbe8-40b5b565ffde">
        <actions>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/ticket" rel="ticket"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/migrate" rel="migrate"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/cancelmigration" rel="cancelmigration"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/shutdown" rel="shutdown"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/start" rel="start"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/stop" rel="stop"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/suspend" rel="suspend"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/detach" rel="detach"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/export" rel="export"/>
            <link href="/api/vms/1eef4b1b-d558-465b-bbe8-40b5b565ffde/move" rel="move"/>
        </actions>
    </vm>
    <status>
        <state>complete</state>
    </status>
</action>

But vm don't run. VM snapshot creating starts, but never ends.

Comment 7 Barak Dagan 2012-11-15 18:14:25 UTC
On si24.1
POST https://aqua-rhel.qa.lab.tlv.redhat.com/api/vmpools/36555118-2f4d-11e2-8663-db57ba5c77ce/allocatevm

<action/>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <vm href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07" id="ceff75ba-2f01-4a53-be83-bd00ac8eda07">
        <actions>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/ticket" rel="ticket"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/migrate" rel="migrate"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/cancelmigration" rel="cancelmigration"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/shutdown" rel="shutdown"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/start" rel="start"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/stop" rel="stop"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/suspend" rel="suspend"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/detach" rel="detach"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/export" rel="export"/>
            <link href="/api/vms/ceff75ba-2f01-4a53-be83-bd00ac8eda07/move" rel="move"/>
        </actions>
    </vm>
    <status>
        <state>complete</state>
    </status>
</action>


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