Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1510508

Summary: Add validation check for available macs in mac pool
Product: [oVirt] ovirt-engine Reporter: Ravi Nori <rnori>
Component: Backend.CoreAssignee: Ravi Nori <rnori>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: bugs, danken, mburman, mperina, oourfali, rnori
Target Milestone: ovirt-4.2.0Flags: rule-engine: ovirt-4.2+
Target Release: ---   
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-12-20 11:27:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Ravi Nori 2017-11-07 15:16:14 UTC
This is a proper fix for the original BZ 1498580.

When there are not enough macs in mac pool, preview vm snapshot fails. The fix for the original BZ was an agreed upon quick fix. Since the check for free macs can be performed at validation time, the validation should fail if there are no free macs in the pool.

Description from original BZ 

Job isn't finished and stuck in the engine db.
Them image is locked for ever and can't be released. 
Preview VM Snapshot is failed and engine aware of it, but the job keep running for ever. NO time out. 

<jobs>
<jobhref="/ovirt-engine/api/jobs/19f3e594-a84c-406e-bd0f-5bf681179fc1"id="19f3e594-a84c-406e-bd0f-5bf681179fc1">
<actions>
<linkhref="/ovirt-engine/api/jobs/19f3e594-a84c-406e-bd0f-5bf681179fc1/clear"rel="clear"/>
<linkhref="/ovirt-engine/api/jobs/19f3e594-a84c-406e-bd0f-5bf681179fc1/end"rel="end"/>
</actions>
<description>Preview VM Snapshot snap4 of VM VM6</description>
<linkhref="/ovirt-engine/api/jobs/19f3e594-a84c-406e-bd0f-5bf681179fc1/steps"rel="steps"/>
<auto_cleared>true</auto_cleared>
<external>false</external>
<last_updated>2017-09-27T10:52:18.730+03:00</last_updated>
<start_time>2017-09-27T10:52:16.205+03:00</start_time>
<status>started</status>
<ownerhref="/ovirt-engine/api/users/586c19dc-00b9-00fa-0364-00000000012f"id="586c19dc-00b9-00fa-0364-00000000012f"/>
</job>

- Snapshot-Preview snap4 for VM VM6 was initiated by admin@internal-authz.
- No MAC addresses left in the MAC Address Pool.
- Some MAC addresses had to be reallocated, but operation failed because of insufficient amount of free MACs.
- Failed to complete Snapshot-Preview snap4 for VM VM6.

- In case of snapshot preview and we need to allocate new MAC for the VM and we have no MACs left, the operation must failed. It is indeed failing and engine aware of the failure, but the job run for ever and stuck in Finalize state. 
The most worst thing here is that the image got locked for ever!

- Steps to reproduce - 
1) Master 4.2
2) 2 VMs in cluster
3) MAC pool range with only
one MAC address in cluster
4) Start VM1 with 1 vNIC
with MAC 'z'
5) Create snapshot from VM1
6) Unplug the vNIC from VM1 and give MAC 'w'(not from the pool) to VM1 and assign MAC address 'z'(the origin MAC) to VM2
7) Try to preview VM1 from snapshot 
Expected Result - should fail
Actual result - Engine failed operation - 
- Snapshot-Preview snap4 for VM VM6 was initiated by admin@internal-authz.
- No MAC addresses left in the MAC Address Pool.
- Some MAC addresses had to be reallocated, but operation failed because of insufficient amount of free MACs.
- Failed to complete Snapshot-Preview snap4 for VM VM6.
But, the job is stuck and image stay locked!

Comment 1 Oved Ourfali 2017-11-08 06:45:05 UTC
Changing team to network, but assigning to Ravi as he posted a patch.

Comment 2 Michael Burman 2017-11-28 06:12:32 UTC
Hi Ravi,

I wasn't aware of this bug and fix, should i run the same scenario test i did for BZ 1498580, making sure that snapshot preview is failed and the job ends up successfully and the image didn't locked?

Thanks,

Comment 3 Michael Burman 2017-11-29 14:04:34 UTC
Verified on - 4.2.0-0.0.master.20171127212333.git11e14b9.el7.centos

- Snapshot-Preview snap1 for VM V2 was initiated by admin@internal-authz.
- No MAC addresses left in the MAC Address Pool.
- Some MAC addresses had to be reallocated, but operation failed because of insufficient amount of free MACs.
- Failed to complete Snapshot-Preview snap1 for VM V2.
- Undoing a Snapshot-Preview for VM V2 was initialized by admin@internal-authz.
- Undoing a Snapshot-Preview for VM V2 has been completed.

Preview snapshot failed, job didn't stuck and the image didn't get locked. Undoing snapshot preview successfully completed.

Comment 4 Sandro Bonazzola 2017-12-20 11:27:18 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

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