Bug 1412230

Summary: Add REST API for VM leases
Product: [oVirt] ovirt-engine Reporter: Tal Nisan <tnisan>
Component: BLL.StorageAssignee: Tal Nisan <tnisan>
Status: CLOSED CURRENTRELEASE QA Contact: Lilach Zitnitski <lzitnits>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: ahadas, bugs, gklein, tnisan
Target Milestone: ovirt-4.1.0-betaFlags: rule-engine: ovirt-4.1+
Target Release: 4.1.0.2   
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-15 15:07:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1417439    
Bug Blocks: 1317429    

Description Tal Nisan 2017-01-11 15:06:44 UTC
Description of problem:
Add REST API for the VM leases feature that allows the user to see leases on each VM/template and add or remove leases

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Lilach Zitnitski 2017-01-24 09:14:24 UTC
Tal, how can I create new lease for vm via rest? I couldn't find it in the rest documentation.

Comment 2 Tal Nisan 2017-01-24 09:59:59 UTC
You send a POST/PUT request for the VM with the storage domain id in the lease field, for instance:

<vm>
    <lease>
        <storage_domain id="11be3393-739e-4157-b89f-40c00b4bb2ab"/>
    </lease>
</vm>

Comment 3 Lilach Zitnitski 2017-01-25 12:16:44 UTC
Tal, there are still two issues with the REST API:

1. when creating new lease the lease is created but the high availability option is not updated to enabled 'true'

    <high_availability>
        <enabled>false</enabled>
        <priority>1</priority>
    </high_availability>

…
    <lease>
        <storage_domain href="/ovirt-engine/api/v4/storagedomains/1b67fa07-406c-42bb-b2fb-a5d92ea24c83" id="1b67fa07-406c-42bb-b2fb-a5d92ea24c83"/>
    </lease>

it also affects the gui, and after you create lease without changing the HA option, you can also do that in the gui as well. before that you had you enable first the HA, and while it's disabled the drop down menu is greyed out. 

2. is there an option to delete lease using the REST API?

Comment 4 Tal Nisan 2017-01-26 08:38:13 UTC
For the 1st please open a separate bug an explain there how do you think the behavior should be

As for deleting a lease, you just send an empty one:
    <lease> </lease>

Comment 5 Lilach Zitnitski 2017-02-01 15:40:44 UTC
--------------------------------------
Tested with the following code:
----------------------------------------
rhevm-4.1.0.3-0.1.el7.noarch

Moving to VERIFIED!

Comment 6 Tal Nisan 2017-02-05 16:22:33 UTC
*** Bug 1410320 has been marked as a duplicate of this bug. ***