Bug 1024961

Summary: Error loading virtual machine information: Internal Server Error -- When Adding Host in Foreman
Product: [Retired] oVirt Reporter: Yamakasi <yamakasi.014>
Component: ovirt-engine-coreAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: bugs <bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.3CC: acathrow, gklein, iheim, juan.hernandez, jvandewege, yamakasi.014, yeylon
Target Milestone: ---   
Target Release: 3.4.0   
Hardware: All   
OS: Linux   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-03 11:29:36 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:

Description Yamakasi 2013-10-30 16:28:35 UTC
Description of problem:

When adding a VM/Host in Foreman and you select the "Deploy On" Ovirt Domain you want to deploy the VM in, the "Virtual Machine" tab appears and gets red colored.

The error in the proxy.log of Foreman and engine.log of Ovirt is like the following:

Read fragment views/tabs_and_title_records-1 (0.4ms)
  Rendered home/_topbar.html.erb (3.7ms)
Completed 200 OK in 1561ms (Views: 1530.6ms | ActiveRecord: 23.6ms)
Started POST "/hosts/compute_resource_selected" for 172.16.5.25 at Tue Oct 29 13:08:41 +0100 2013
Processing by HostsController#compute_resource_selected as */*
  Parameters: {"authenticity_token"=>”XXXXXXXXXXXXXXXXXXXXX=", "host"=>{"hostgroup_id"=>"", "provision_method"=>"build", "comment"=>"", "build"=>"1", "environment_id"=>"", "puppet_proxy_id"=>"", "interfaces_attributes"=>{"new_interfaces"=>{"provider"=>"IPMI", "_destroy"=>"false", "type"=>"Nic::Managed", "domain_id"=>"", "name"=>"", "mac"=>"", "ip"=>""}}, "disk"=>"", "enabled"=>"1", "type"=>"Host::Managed", "managed"=>"true", "domain_id"=>"", "is_owned_by"=>"", "name"=>"", "compute_resource_id"=>"1", "progress_report_id"=>"[FILTERED]", "root_pass"=>"[FILTERED]", "model_id"=>"", "puppet_ca_proxy_id"=>"", "mac"=>"", "ip"=>"", "architecture_id"=>"", "overwrite"=>"false"}, "utf8"=>"✓"}
  Rendered compute_resources_vms/form/_ovirt.html.erb (416.2ms)
  Rendered hosts/_compute.html.erb (520.9ms)
Operation FAILED: statementcallback; bad sql grammar select * from (select * from vds groups view where ( vds group id in (select vds groups storage domain.vds group id from  vds groups storage domain   left outer join storage pool with storage domain on vds groups storage domain.storage pool id=storage pool with storage domain.id    where  (  storage pool with storage domain.name like '%MyDomain%' or  storage pool with storage domain.description like '%MyDomain%' or  storage pool with storage domain.comment like '%MyDomain%' ) ))  order by name asc ) as t1 offset (1 -1) limit 100; nested exception is org.postgresql.util.psqlexception: error: column storage pool with storage domain.comment does not exist
  position: 425
  Rendered common/500.html.erb (5.4ms)


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

Ovirt 3.3.0.1
Foreman 1.3.0


How reproducible:

Add a VM in Foreman and deploy on a Ovirt Enviroment.


Steps to Reproduce:
1. Login to Foreman
2. Add a hosts
3. Select "Deploy on" OvirtEngineName

Actual results:

On the Virtual Machine tab:

Error loading virtual machine information: Internal Server Error


Expected results:

The Ovirt Engine Environment Variables


Additional info:

Comment 1 Joop van de Wege 2013-11-01 12:01:17 UTC
I have the same problem, same versions of oVirt and Foreman, 3.3.0-4.el6 and 1.3.0

Either Foreman or oVirt are internally generating the wrong query statement. What follows is what I posted to irc

YamakasY: for reference: somewhere either Foreman or oVirt-engine is generating a wrong query. The view storage_pool_with_storage_domain is having a free_text_commnent column but either FM or oVirt is looking for a comment column.
[12:46]	YamakasY: my understanding of the ovirt code (30min looking around) is that there are calls which query the database for the layout of the table/view and then use that to construct the query or use the view and add columns to it using code. In the latter there is probably somewhere a line of code that adds the 'comment' column and then the query for storage_domains blows up.
[12:47]	YamakasY: my quick hack is regenerating the view with an extra column, comment, and then FM works again.

YamakasY: ALTER TABLE storage_pool ADD COLUMN comment text;
	DROP VIEW storage_pool_with_storage_domain;
	CREATE OR REPLACE VIEW storage_pool_with_storage_domain AS
	SELECT storage_pool.id, storage_pool.name, storage_pool.description, storage_pool.free_text_comment, storage_pool.comment, storage_pool.storage_pool_type, storage_pool.status, storage_pool.master_domain_version, storage_pool.spm_vds_id, storage_pool.compatibility_version, storage_pool._create_date, storage_pool._update_date, storage_pool_iso_map.storage_id, storage_pool_iso_map.storage_pool_id, s
	torage_domain_static.storage_type, storage_domain_static.storage_domain_type, storage_domain_static.storage_domain_format_type, storage_domain_static.storage_name, storage_domain_static.storage, storage_domain_static.last_time_used_as_master
	FROM storage_pool
	LEFT JOIN storage_pool_iso_map ON storage_pool.id = storage_pool_iso_map.storage_pool_id
	LEFT JOIN storage_domain_static ON storage_pool_iso_map.storage_id = storage_domain_static.id;
	ALTER TABLE storage_pool_with_storage_domain OWNER TO engine;
[12:55]	YamakasY: Don't forget to backup your DATABASE!!!!

Comment 2 Itamar Heim 2014-01-12 08:42:21 UTC
setting target release to current version for consideration and review. please do not push non-RFE bugs to an undefined target release to make sure bugs are reviewed for relevancy, fix, closure, etc.

Comment 3 Joop van de Wege 2014-01-17 08:22:34 UTC
I don't have this problem anymore since I upgraded to either 3.3.1 or 3.3.2 that I'm now using.
oVirt-3.3.2el6 + Foreman-1.3.2 and oVirt-3.3.2-fc19 + Foreman-1.3.2

Joop

Comment 4 Itamar Heim 2014-01-17 23:39:24 UTC
Yamakasi - can you please check as well per comment 3?

Comment 5 Juan Hernández 2014-03-03 11:29:36 UTC
This was an error in the storage pool field autocompleter, and was fixed by the following change, included in 3.3.1:

http://gerrit.ovirt.org/19217