Bug 854492 - Failed to activate ISO domain that is already attached to 2 DC
Failed to activate ISO domain that is already attached to 2 DC
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.1.0
Unspecified Unspecified
high Severity high
: ---
: 3.1.0
Assigned To: Eli Mesika
Leonid Natapov
storage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-05 03:33 EDT by Eli Mesika
Modified: 2016-02-10 12:56 EST (History)
10 users (show)

See Also:
Fixed In Version: SI18
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eli Mesika 2012-09-05 03:33:31 EDT
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 04:34:06 EDT
http://gerrit.ovirt.org/#/c/7804/1
Comment 3 Leonid Natapov 2012-09-20 07:04:00 EDT
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.