Bug 878344

Summary: engine: AddVdsSpmIdCommand throw exception when trying to edit cluster after DC force remove
Product: Red Hat Enterprise Virtualization Manager Reporter: Dafna Ron <dron>
Component: ovirt-engineAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Dafna Ron <dron>
Severity: medium Docs Contact:
Priority: high    
Version: 3.1.0CC: bazulay, dyasny, gickowic, hateya, iheim, lpeer, obasan, pspacek, Rhev-m-bugs, rvaknin, sgrinber, yeylon, ykaul, yzaslavs
Target Milestone: ---Keywords: Regression
Target Release: 3.2.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: infra
Fixed In Version: sf6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-11 08:19:42 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:
Bug Depends On:    
Bug Blocks: 915537    
Attachments:
Description Flags
log none

Description Dafna Ron 2012-11-20 08:06:28 UTC
Created attachment 648339 [details]
log

Description of problem:

I forced removed a DC and tried to edit the cluster which is currently attached to a host to add a new DC to the cluster. 
UI shows: 
Error while executing action Edit Cluster properties: Internal oVirt Engine Error 

engine logs shows: 

2012-11-20 09:55:49,764 ERROR [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (ajp-/127.0.0.1:8702-10) [61227938] Command org.ovirt.engine.core.bll.AddVdsSpmIdCommand throw exce
ption: org.springframework.dao.DuplicateKeyException: CallableStatementCallback; SQL [{call insertvds_spm_id_map(?, ?, ?)}]; ERROR: duplicate key value violates unique constrai
nt "pk_vds_spm_id_map"

this will not help the user to understand what the issue is. 

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

si24.2

How reproducible:

100%

Steps to Reproduce:
1. create a DC and a cluster and attach them to two hosts
2. force remove the DC
3. create a new DC 
4. in the Cluster tab edit the current cluster and try to save the new DC you created
  
Actual results:

2012-11-20 09:55:49,764 ERROR [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (ajp-/127.0.0.1:8702-10) [61227938] Command org.ovirt.engine.core.bll.AddVdsSpmIdCommand throw exce
ption: org.springframework.dao.DuplicateKeyException: CallableStatementCallback; SQL [{call insertvds_spm_id_map(?, ?, ?)}]; ERROR: duplicate key value violates unique constrai
nt "pk_vds_spm_id_map"

Expected results:

if this operation is not allowed we should have a clear error displayed. 

Additional info: log

2012-11-20 09:55:49,763 INFO  [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (ajp-/127.0.0.1:8702-10) [61227938] Running command: AddVdsSpmIdCommand internal: true. Entities af
fected :  ID: f495558e-316d-11e2-87b0-001a4a169741 Type: VDS
2012-11-20 09:55:49,764 ERROR [org.ovirt.engine.core.bll.AddVdsSpmIdCommand] (ajp-/127.0.0.1:8702-10) [61227938] Command org.ovirt.engine.core.bll.AddVdsSpmIdCommand throw exce
ption: org.springframework.dao.DuplicateKeyException: CallableStatementCallback; SQL [{call insertvds_spm_id_map(?, ?, ?)}]; ERROR: duplicate key value violates unique constrai
nt "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:75) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:876) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:973) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1372) [engine-bll.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInRequired(TransactionSupport.java:144) [engine-utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:109) [engine-utils.jar:]
        at org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:991) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:291) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:350) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runInternalAction(Backend.java:290) [engine-bll.jar:]

Comment 1 Haim 2012-11-22 17:05:16 UTC
*** Bug 879362 has been marked as a duplicate of this bug. ***

Comment 3 Yaniv Kaul 2012-11-25 09:05:03 UTC
*** Bug 876889 has been marked as a duplicate of this bug. ***

Comment 4 Rami Vaknin 2012-12-05 08:54:57 UTC
Note that this bug still reproduces on si24.5

Comment 5 Petr Spacek 2012-12-12 11:52:05 UTC
This bug is still present in following installation:

rhevm-backend-3.1.0-32.el6ev.noarch
rhevm-userportal-3.1.0-32.el6ev.noarch
rhevm-genericapi-3.1.0-32.el6ev.noarch
rhevm-3.1.0-32.el6ev.noarch
rhevm-sdk-3.1.0.16-1.el6ev.noarch
rhevm-log-collector-3.1.0-9.el6ev.noarch
rhevm-config-3.1.0-32.el6ev.noarch
rhevm-spice-client-x64-cab-3.1-8.el6.noarch
rhevm-dbscripts-3.1.0-32.el6ev.noarch
rhevm-cli-3.1.0.17-1.el6ev.noarch
rhevm-image-uploader-3.1.0-7.el6ev.noarch
rhevm-tools-common-3.1.0-32.el6ev.noarch
rhevm-spice-client-x86-cab-3.1-8.el6.noarch
rhevm-doc-3.1.0-21.el6eng.noarch
rhevm-webadmin-portal-3.1.0-32.el6ev.noarch
rhevm-setup-3.1.0-32.el6ev.noarch
rhevm-notification-service-3.1.0-32.el6ev.noarch
rhevm-restapi-3.1.0-32.el6ev.noarch
rhevm-iso-uploader-3.1.0-8.el6ev.noarch

I can provide snapshot of "crippled" RHEV-M machine.

Comment 6 Barak 2013-01-06 14:35:19 UTC
Simon,

Should we allow force removal of DC with active clusters ?

Comment 7 Simon Grinberg 2013-01-06 15:01:22 UTC
(In reply to comment #6)
> Simon,
> 
> Should we allow force removal of DC with active clusters ?

Yes, since force remove DC should be allowed only when all the hosts are in maintenance. There should be no problem then to move the clusters and the hosts underneath to a new DC instead of forcing the user to delete all hosts and re-add to a new DC.

There is a related bug around that which I fail to find ATM.

Comment 8 Yair Zaslavsky 2013-01-15 18:06:46 UTC
*** Bug 894073 has been marked as a duplicate of this bug. ***

Comment 9 Eli Mesika 2013-01-21 16:33:35 UTC
http://gerrit.ovirt.org/#/c/11271/

Comment 10 Eli Mesika 2013-01-27 13:34:37 UTC
fixed in commit : ba263d0

Comment 12 Yair Zaslavsky 2013-02-10 11:41:42 UTC
*** Bug 907153 has been marked as a duplicate of this bug. ***

Comment 13 Dafna Ron 2013-05-19 09:24:40 UTC
verified on sf17

Comment 14 Itamar Heim 2013-06-11 08:19:42 UTC
3.2 has been released

Comment 15 Itamar Heim 2013-06-11 08:23:28 UTC
3.2 has been released