Bug 1021393

Summary: Creating VM from Foreman fails with oVirt 3.3.1 beta.
Product: [Retired] oVirt Reporter: Samuli Heinonen <samppah>
Component: ovirt-engine-apiAssignee: Gilad Chaplik <gchaplik>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 3.3CC: acathrow, dfediuck, emesika, gchaplik, iheim, samppah, sbonazzo, yeylon
Target Milestone: ---   
Target Release: 3.3.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sla
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1022942 (view as bug list) Environment:
Last Closed: 2013-11-25 11:48:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1019391, 1022942    
Attachments:
Description Flags
engine.log during VM create none

Description Samuli Heinonen 2013-10-21 08:45:01 UTC
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.

Comment 1 Samuli Heinonen 2013-10-21 08:45:42 UTC
Created attachment 814461 [details]
engine.log during VM create

Comment 2 Eli Mesika 2013-10-22 07:20:54 UTC
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

Comment 3 Samuli Heinonen 2013-10-22 08:04:46 UTC
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.

Comment 4 Gilad Chaplik 2013-10-23 07:33:11 UTC
Can you see if you have quota definition in foreman compute resource definition?

Comment 5 Samuli Heinonen 2013-10-23 07:55:04 UTC
(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.

Comment 6 Gilad Chaplik 2013-10-23 12:03:34 UTC
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.

Comment 7 Itamar Heim 2013-10-23 18:13:40 UTC
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?

Comment 8 Gilad Chaplik 2013-10-24 07:19:08 UTC
(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 9 Sandro Bonazzola 2013-11-25 11:48:31 UTC
oVirt 3.3.1 has been released