Bug 1148301

Summary: Assigning a Data Center for a cluster containing a Host, without Data Center assigned to the cluster (Since the previous DC was removed) causes an internal error
Product: [Retired] oVirt Reporter: Maor <mlipchuk>
Component: ovirt-engine-coreAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5CC: ecohen, gklein, iheim, lsurette, oourfali, rbalakri, yeylon
Target Milestone: ---   
Target Release: 3.5.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: ovirt-3.5.1_rc1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 16:06:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine log none

Description Maor 2014-10-01 07:01:58 UTC
Created attachment 942924 [details]
engine log

Description of problem:
Try to assign a Data Center for a cluster containing a Host, and the Data Center does not contain Data Center attached to it, since the previous Data Center was removed from the setup, causes the following sql exception:

2014-10-01 09:48:21,326 INFO  [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (http--0.0.0.0-8080-2) [6e1775a9] Running command: AddVdsSpmIdCommand internal: true. Entities affected :  ID: 2cf2a7f9-4940-475d-9a2c-6e6a0aad678a Type: VDS
2014-10-01 09:48:21,328 ERROR [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (http--0.0.0.0-8080-2) [6e1775a9] Command org.ovirt.engine.core.bll.AddVdsSpmIdCommand throw exception: org.springframework.dao.DataIntegrityViolationException: 
CallableStatementCallback; SQL [{call insertvds_spm_id_map(?, ?, ?)}]; ERROR: insert or update on table "vds_spm_id_map" violates foreign key constraint "fk_vds_spm_id_map_storage_pool"
  Detail: Key (storage_pool_id)=(00000000-0000-0000-0000-000000000000) is not present in table "storage_pool".
  Where: SQL statement "INSERT INTO vds_spm_id_map(storage_pool_id, vds_id, vds_spm_id)
        VALUES(v_storage_pool_id, v_vds_id, v_vds_spm_id)"
PL/pgSQL function insertvds_spm_id_map(uuid,uuid,integer) line 3 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: insert or update on table "vds_spm_id_map" violates foreign key constraint "fk_vds_spm_id_map
_storage_pool"
  Detail: Key (storage_pool_id)=(00000000-0000-0000-0000-000000000000) is not present in table "storage_pool".
  Where: SQL statement "INSERT INTO vds_spm_id_map(storage_pool_id, vds_id, vds_spm_id)
        VALUES(v_storage_pool_id, v_vds_id, v_vds_spm_id)"
PL/pgSQL function insertvds_spm_id_map(uuid,uuid,integer) line 3 at SQL statement
....
.....
.....

        at org.ovirt.engine.core.branding.BrandingFilter.doFilter(BrandingFilter.java:72)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.ovirt.engine.core.utils.servlet.LocaleFilter.doFilter(LocaleFilter.java:64) [utils.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.ovirt.engine.core.aaa.filters.SessionMgmtFilter.doFilter(SessionMgmtFilter.java:31) [aaa.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.ovirt.engine.core.aaa.filters.LoginFilter.doFilter(LoginFilter.java:73) [aaa.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.ovirt.engine.core.aaa.filters.NegotiationFilter.doFilter(NegotiationFilter.java:112) [aaa.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.ovirt.engine.core.aaa.filters.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:75) [aaa.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.ovirt.engine.core.aaa.filters.SessionValidationFilter.doFilter(SessionValidationFilter.java:63) [aaa.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489)
        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.rewrite.RewriteValve.invoke(RewriteValve.java:466)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on table "vds_spm_id_map" violates foreign key constraint "fk_vds_spm_id_map_storage_pool"
  Detail: Key (storage_pool_id)=(00000000-0000-0000-0000-000000000000) is not present in table "storage_pool".
  Where: SQL statement "INSERT INTO vds_spm_id_map(storage_pool_id, vds_id, vds_spm_id)
        VALUES(v_storage_pool_id, v_vds_id, v_vds_spm_id)"
PL/pgSQL function insertvds_spm_id_map(uuid,uuid,integer) line 3 at SQL statement
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:381)
        at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.execute(CachedPreparedStatement.java:297)
        at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.execute(WrappedPreparedStatement.java:404)
        at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1066) [spring-jdbc.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1) [spring-jdbc.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1014) [spring-jdbc.jar:3.1.1.RELEASE]


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


How reproducible:


Steps to Reproduce:
1. Have a Data Center with Host and cluster (Tested on 3.5)
2. Remove the Data Center
3. Create a new Data Center
4. Try to assign the cluster to the new Data Center

Actual results:
Getting an Internal Error, the only way to bypass it is to remove the cluster

Expected results:
The assign should work

Additional info:


Document URL: 

Section Number and Name: 

Describe the issue: 

Suggestions for improvement: 

Additional information: 


Description of problem:


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Sandro Bonazzola 2015-01-15 14:15:38 UTC
This is an automated message: 
This bug should be fixed in oVirt 3.5.1 RC1, moving to QA

Comment 2 Sandro Bonazzola 2015-01-21 16:06:32 UTC
oVirt 3.5.1 has been released. If problems still persist, please make note of it in this bug report.