This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 893089

Summary: [engine-backend] nested exception when trying to add host with name that already exists: ERROR: duplicate key value violates unique constraint "vds_s tatic_vds_name_unique"
Product: Red Hat Enterprise Virtualization Manager Reporter: Haim <hateya>
Component: ovirt-engineAssignee: Laszlo Hornyak <lhornyak>
Status: CLOSED CURRENTRELEASE QA Contact: Leonid Natapov <lnatapov>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: ahadas, dfediuck, dyasny, iheim, lpeer, Rhev-m-bugs, sgrinber, shireesh, yeylon, ykaul, yzaslavs
Target Milestone: ---Keywords: Regression
Target Release: 3.2.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: infra
Fixed In Version: sf9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 896546 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 896546, 917401    
Attachments:
Description Flags
engine log. none

Description Haim 2013-01-08 09:46:13 EST
Description of problem:

1) add new host with name X
2) wait for host to be installed
3) add additional host with name X

Error: Internal Error

Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "vds_static_vds_name_unique"
  Where: SQL statement "INSERT INTO vds_static(vds_id,host_name, ip, vds_unique_id, port, vds_group_id, vds_name, server_SSL_enabled, vds_type,vds_strength,pm_type,pm_user,pm_password,pm_port,pm_options,pm_enabled, pm_proxy_preferences, pm_secondary_ip, pm_secondary_type, pm_secondary_user, pm_secondary_password, pm_secondary_port, pm_secondary_options, pm_secondary_concurrent, vds_spm_priority, sshKeyFingerprint) VALUES( $1 , $2 ,  $3 ,  $4 ,  $5 ,  $6 ,  $7 ,  $8 ,  $9 , $10 , $11 , $12 , $13 , $14 , $15 , $16 ,  $17 ,  $18 ,  $19 ,  $20 ,  $21 ,  $22 ,  $23 ,  $24 ,  $25 ,  $26 )"
PL/pgSQL function "insertvdsstatic" line 4 at SQL statement
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:360)
        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-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1014) [spring-jdbc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
        ... 93 more
Comment 1 Haim 2013-01-08 09:49:31 EST
Created attachment 674876 [details]
engine log.
Comment 3 Haim 2013-01-08 11:05:30 EST
*** Bug 893097 has been marked as a duplicate of this bug. ***
Comment 4 Laszlo Hornyak 2013-01-09 04:03:07 EST
What is the expected behavior? The name is unique indeed. You want to hide the DB exception with a custom one?
Comment 5 Yair Zaslavsky 2013-01-10 04:55:56 EST
Laszlo - we would like it to be blocked both UI and with canDoAction.
Comment 6 Laszlo Hornyak 2013-01-10 05:07:54 EST
Thx! Ok, that will catch most of the exceptions, parallel transactions can still cause the old exception. I assume that is good enough, since catching the data integrity exception would make the check in canDoAction redundant.
Comment 7 Laszlo Hornyak 2013-01-11 10:51:55 EST
related issue https://bugzilla.redhat.com/show_bug.cgi?id=894382
Comment 8 Laszlo Hornyak 2013-01-11 11:06:55 EST
http://gerrit.ovirt.org/10910
Comment 9 Haim 2013-01-17 08:46:48 EST
removing need-info + providing QA_ACK.
Comment 10 Shireesh 2013-01-18 08:26:57 EST
A very similar issue happens for the unique constraint on host_name (vds_static_host_name_unique) as well. Refer RHS-C Bug 896475. Should that also be fixed as part of this bug?
Comment 11 Laszlo Hornyak 2013-01-18 14:48:39 EST
(In reply to comment #10)
> A very similar issue happens for the unique constraint on host_name
> (vds_static_host_name_unique) as well. Refer RHS-C Bug 896475. Should that
> also be fixed as part of this bug?

Thanks for pointing that out, let's solve that problem as well. Haim, is this ok for you too?
Comment 12 Leonid Natapov 2013-03-05 09:27:33 EST
sf9. fixed. getiing Error: Cannot add Host. Host with the same name already exists.
Comment 13 Itamar Heim 2013-06-11 05:09:43 EDT
3.2 has been released
Comment 14 Itamar Heim 2013-06-11 05:09:46 EDT
3.2 has been released
Comment 15 Itamar Heim 2013-06-11 05:37:36 EDT
3.2 has been released