Bug 894073

Summary: [engine-backend] unable to rename orphane cluster and set to new DC: DuplicateKeyException: CallableStatementCallback; SQL [{call insertvds_spm_id_map(?, ?, ?)}]; ERROR: duplicate key value violates unique constrain t "pk_vds_spm_id_map"
Product: Red Hat Enterprise Virtualization Manager Reporter: Haim <hateya>
Component: ovirt-engineAssignee: Eli Mesika <emesika>
Status: CLOSED DUPLICATE QA Contact: Haim <hateya>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: dyasny, iheim, lpeer, Rhev-m-bugs, yeylon, ykaul, yzaslavs
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-15 13:06:46 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
engine log. none

Description Haim 2013-01-10 11:11:51 EST
Description of problem:

1) create pool with 1 storage domain and 2 hosts
2) move pool to maintenance 
3) force remove pool
4) create new DC with name X
5) rename DC X to y
6) edit orphan cluster (vds_group) and set it to DC Y (while renaming cluster as well).

2013-01-10 18:04:59,730 INFO  [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (ajp-/127.0.0.1:8702-8) [7b8735e3] Running command: AddVdsSpmIdCommand internal: true. Entities aff
ected :  ID: 412d96ae-c844-4f2f-838b-3305d2878154 Type: VDS
2013-01-10 18:04:59,737 ERROR [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (ajp-/127.0.0.1:8702-8) [7b8735e3] Command org.ovirt.engine.core.bll.AddVdsSpmIdCommand throw excep
tion: org.springframework.dao.DuplicateKeyException: CallableStatementCallback; SQL [{call insertvds_spm_id_map(?, ?, ?)}]; ERROR: duplicate key value violates unique constrain
t "pk_vds_spm_id_map"
  Where: SQL statement "INSERT INTO vds_spm_id_map(storage_pool_id, vds_id, vds_spm_id) VALUES( $1 ,  $2 ,  $3 )"
PL/pgSQL function "insertvds_spm_id_map" line 2 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "
pk_vds_spm_id_map"
  Where: SQL statement "INSERT INTO vds_spm_id_map(storage_pool_id, vds_id, vds_spm_id) VALUES( $1 ,  $2 ,  $3 )"
PL/pgSQL function "insertvds_spm_id_map" line 2 at SQL statement
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:241) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.REL
EASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) [spring-jdbc-3.1.1.RELEASE.jar:3.1.
1.RELEASE]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1030) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1064) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:388) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:351) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:181) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:124) [engine-dal.jar:]
        at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeModification(SimpleJdbcCallsHandler.java:37) [engine-dal.jar:]
        at org.ovirt.engine.core.dao.VdsSpmIdMapDAODbFacadeImpl.save(VdsSpmIdMapDAODbFacadeImpl.java:42) [engine-dal.jar:]
        at org.ovirt.engine.core.dao.VdsSpmIdMapDAODbFacadeImpl.save(VdsSpmIdMapDAODbFacadeImpl.java:17) [engine-dal.jar:]
        at org.ovirt.engine.core.bll.AddVdsSpmIdCommand.executeCommand(AddVdsSpmIdCommand.java:76) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:997) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:1082) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1463) [engine-bll.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInRequired(TransactionSupport.java:143) [engine-utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:110) [engine-utils.jar:]
        at org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:1100) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:302) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:358) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runInternalAction(Backend.java:295) [engine-bll.jar:]
        at sun.reflect.GeneratedMethodAccessor127.invoke(Unknown Source) [:1.7.0_09-icedtea]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:
72) [jboss-as-ee.jar:7.1.3.Final-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation.jar:1.1.1.Final-redhat-2]
Comment 1 Haim 2013-01-10 11:14:45 EST
Created attachment 676405 [details]
engine log.
Comment 3 Yair Zaslavsky 2013-01-15 13:06:46 EST
Same transactivity issue as in https://bugzilla.redhat.com/878344 Around the area of getting the correct number of spm_id_map entries.

*** This bug has been marked as a duplicate of bug 878344 ***