Bug 1507214

Summary: VM lease creation doesn't occur properly during VM shutdown
Product: [oVirt] ovirt-engine Reporter: Alex Kaouris <rightkicktech>
Component: GeneralAssignee: Eyal Shenitzky <eshenitz>
Status: CLOSED CURRENTRELEASE QA Contact: Avihai <aefrat>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.1.6.2CC: amureini, bugs, lveyde, ratamir, tnisan
Target Milestone: ovirt-4.1.9Flags: rule-engine: ovirt-4.1+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-engine-4.1.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-24 10:41:18 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:    
Bug Blocks: 1481691    
Attachments:
Description Flags
Engine log file
none
vdsm log of host where VM is running none

Description Alex Kaouris 2017-10-28 11:32:58 UTC
Created attachment 1344675 [details]
Engine log file

Description of problem:
While attempting to enable the VM leases for a specific VM I am receiving an error that the lease cannot be hot plug and that the VM is running without a lease. 

The errors in engine dashboard are the following: 
Failed to hot plug lease to the VM Generic_win10. The VM is running without a VM lease.
VDSM v1.iv command HotPlugLeaseVDS failed: Virtual machine does not exist: {'vmId': u'b297e986-a820-47b2-a684-fea2978458ab'}

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

How reproducible:
Always

Steps to Reproduce:
1.While shutdown, edit VM and enable lease to a data storage domain (gluster replica 3)
2.Start VM
3.You receive the error while the storage domains lists a lease for the VM (at engine dashboard -> storage -> leases)

Actual results:
Seems that lease is assigned but an error is displayed

Expected results:
The lease should be assigned without giving an error

Additional info:
No HA tests have been performed to confirm if the lease is actually active

Comment 1 Alex Kaouris 2017-10-28 11:34:39 UTC
Created attachment 1344677 [details]
vdsm log of host where VM is running

vdsm log of host where VM is running

Comment 2 Alex Kaouris 2017-10-28 20:15:47 UTC
Seems that the above rises when enabling the VM leases on a VM and then starting the VM without waiting first the task of enabling the lease to complete. 

Seems that the below resolves the issue: 

1. Remove the VM lease.
2. Restart ovirt-engine service(I did this since the engine was continuing to log that was not able to enable the lease)
3. Enable VM lease and wait until the this task is completed (shown at GUI -> Tasks). This might take even a minute or more. 
4. Start the VM. No more errors.

Comment 3 Avihai 2018-01-16 09:55:41 UTC
verified on 4.1.9-0.2.el7

Comment 4 Sandro Bonazzola 2018-01-24 10:41:18 UTC
This bugzilla is included in oVirt 4.1.9 release, published on Jan 24th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.1.9 release, published on Jan 24th 2018, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.