Bug 854492 - Failed to activate ISO domain that is already attached to 2 DC
Summary: Failed to activate ISO domain that is already attached to 2 DC
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 3.1.0
Assignee: Eli Mesika
QA Contact: Leonid Natapov
URL:
Whiteboard: storage
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-05 07:33 UTC by Eli Mesika
Modified: 2018-12-02 16:53 UTC (History)
10 users (show)

Fixed In Version: SI18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Storage
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Eli Mesika 2012-09-05 07:33:31 UTC
Description of problem:
This Bug was reported by Dan Yasny on a 3.1 clean install
After the installation, the ISO Storage Domain was already addatched to the Default DC.
Adding a new DC and attaching the ISO domain to it as well 
Then, trying to activate the ISO domain on the new DC generates a SQL ERROR:

"more than one row returned by a subquery used as an expression"

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

How reproducible:
always

Steps to Reproduce:
1.Clean install
2.Add a new DC 
3.Attach ISO domain to the new DC
4.Activate the ISO domain in new DC
  
Actual results:
SQL Exception
"more than one row returned by a subquery used as an expression"

Expected results:
Activate should succeed

Additional info:

This is a general error that might hav afffect on other flows as well.

During the activate a call to get_entity_permissions SQL function is issued
This in turn calls : fn_get_entity_parents
For the relevant scenario the following code is executed :

 WHEN v_entity_type = 11 THEN -- Storage Domain

                RETURN QUERY
                        SELECT system_root_id AS id
                        UNION
                        SELECT storage_pool_id as id FROM storage_pool_iso_map WHERE storage_id = v_entity_id
                        UNION
                        SELECT v_entity_id AS id;

Postgres assumes that 
SELECT storage_pool_id as id FROM storage_pool_iso_map 
is returning a literal
In order to fix that we must change in fn_get_entity_parents for all v_entity_type to use UNION ALL instead of UNION
i.e in this case the following code will work:


 WHEN v_entity_type = 11 THEN -- Storage Domain

                RETURN QUERY
                        SELECT system_root_id AS id
                        UNION ALL
                        SELECT storage_pool_id as id FROM storage_pool_iso_map WHERE storage_id = v_entity_id
                        UNION ALL
                        SELECT v_entity_id AS id;

Comment 1 Eli Mesika 2012-09-06 08:34:06 UTC
http://gerrit.ovirt.org/#/c/7804/1

Comment 3 Leonid Natapov 2012-09-20 11:04:00 UTC
si18. can attach ISO domain to several DC. (more than 2).


Note You need to log in before you can comment on or make changes to this bug.