Bug 1022942

Summary: Creating VM from Foreman fails with oVirt 3.3.1 beta.
Product: Red Hat Enterprise Virtualization Manager Reporter: Gilad Chaplik <gchaplik>
Component: ovirt-engineAssignee: Gilad Chaplik <gchaplik>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Svaty <lsvaty>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 3.3.0CC: acathrow, dfediuck, emesika, gchaplik, iheim, lpeer, mavital, Rhev-m-bugs, samppah, sbonazzo, yeylon
Target Milestone: ---Keywords: Triaged
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sla
Fixed In Version: is22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1021393 Environment:
Last Closed: 2014-01-21 22:12:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1021393    
Bug Blocks: 1019391, 1032811    

Description Gilad Chaplik 2013-10-24 10:11:05 UTC
+++ This bug was initially created as a clone of Bug #1021393 +++

Description of problem:
This is fresh install of 3.3.1 beta engine running on CentOS 6.4. Trying to create VM from Foreman 1.2/1.3 fails and shows following error message in engine.log "ERROR: insert or update on table "images" violates foreign key constraint "fk_images_quota". Full log attached.


Version-Release number of selected component (if applicable):
oVirt 3.3.1-0.1.beta.el6


Steps to Reproduce:
1. Create new VM from Foreman

Actual results:
Creating of VM fails and Foreman displays error: 
Unable to save
Failed to create a compute dev-el6 (oVirt) instance gg6.domain.tld

Expected results:
VM is created successfully into oVirt.

--- Additional comment from Samuli Heinonen on 2013-10-21 04:45:42 EDT ---



--- Additional comment from Eli Mesika on 2013-10-22 03:20:54 EDT ---

The following upgrade script 
03_03_0900_quota_id_foreign_key.sql added this FK constraint :

ALTER TABLE images ADD CONSTRAINT fk_images_quota FOREIGN KEY (quota_id) REFERENCES quota(id) ON DELETE SET NULL;

So, it seems that there is an attempt to create a VM with an invalid QUOTA ID

--- Additional comment from Samuli Heinonen on 2013-10-22 04:04:46 EDT ---

Some additional information about my setup if needed:
Quota is disabled on this datacenter and Foreman is using admin@internal to 
connect oVirt.

I tried enabling quota and problem still exists. Also it seems that it's not possible to set quota for admin.

--- Additional comment from Gilad Chaplik on 2013-10-23 03:33:11 EDT ---

Can you see if you have quota definition in foreman compute resource definition?

--- Additional comment from Samuli Heinonen on 2013-10-23 03:55:04 EDT ---

(In reply to Gilad Chaplik from comment #4)
> Can you see if you have quota definition in foreman compute resource
> definition?

It shows Quota ID field but there are no variables. Quota is currently disabled in datacenter.

I just tried enabling quota in datacenter and made quota definition for it. It shows in compute resource definition and selecting it it's possible to create VM's from foreman.

So this seems to be problem only if quota is disabled and there is no quota defined in oVirt.

--- Additional comment from Gilad Chaplik on 2013-10-23 08:03:34 EDT ---

The problem is that foreman is sending empty string for disk's quota (not for vm btw), then the engine subs empty string with empty UUID (000...). prior to the fix mentioned in comment 2, it was possible to save empty UUID as quota id.

--- Additional comment from Itamar Heim on 2013-10-23 14:13:40 EDT ---

do we treat this as a regression to backward compatibility, or a change due to a bug which must be fixed and foreman needs to be changed?

--- Additional comment from Gilad Chaplik on 2013-10-24 03:19:08 EDT ---

(In reply to Itamar Heim from comment #7)
> do we treat this as a regression to backward compatibility, or a change due
> to a bug which must be fixed and foreman needs to be changed?

I don't think it's a backward compatibility issue, since foreman didn't send a empty UUID, just an empty string and the REST treat it as empty UUID.
Since quota is not supported in the REST, I guess we can simply ignore empty UUID
in the engine, and fix it in foreman ovirt component (sent patches for both).

Samuli (the bug reporter) verified that the problem is solved (by fixing rbovirt).

Comment 2 Lukas Svaty 2013-11-28 14:32:18 UTC
tested in is25

Comment 3 Itamar Heim 2014-01-21 22:12:57 UTC
Closing - RHEV 3.3 Released

Comment 4 Itamar Heim 2014-01-21 22:21:00 UTC
Closing - RHEV 3.3 Released