Bug 1252396

Summary: Create a vm and start running on a specific host fails with Internal Server Error - SQL error ( InsertDedicatedHostsToVm)
Product: [Retired] oVirt Reporter: Carlos Mestre González <cmestreg>
Component: ovirt-engine-coreAssignee: Roy Golan <rgolan>
Status: CLOSED DUPLICATE QA Contact: Pavel Stehlik <pstehlik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.6CC: bugs, ecohen, gklein, lsurette, rbalakri, rgolan, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sla
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-11 12:16:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Carlos Mestre González 2015-08-11 10:24:11 UTC
Description of problem:
Internal Server Error after trying to add a Vm and specify a host

Version-Release number of selected component (if applicable):
ovirt-engine-3.6.0-0.0.master.20150804111407.git122a3a0.el6.noarch

How reproducible:
50% ? I'm not sure why sometimes fails others don't, seems to fail for SPM always.

Steps to Reproduce:
1. Add a vm with a name, and in Host tab-> Start runing on select an specific host (for example the SPM)

Actual results:
Fails creating with Internal Server Error
015-08-11 13:13:01,704 INFO  [org.ovirt.engine.core.bll.AddVmCommand] (default task-18) [] Running co
mmand: AddVmCommand internal: false. Entities affected :  ID: 9a543f3d-fd10-4491-a704-51b041243f81 Typ
e: VdsGroupsAction group CREATE_VM with role type USER,  ID: 00000000-0000-0000-0000-000000000000 Type
: VmTemplateAction group CREATE_VM with role type USER,  ID: 9a543f3d-fd10-4491-a704-51b041243f81 Type
: VdsGroupsAction group EDIT_ADMIN_VM_PROPERTIES with role type ADMIN
2015-08-11 13:13:01,782 INFO  [org.ovirt.engine.core.utils.transaction.TransactionSupport] (default ta
sk-18) [] transaction rolled back
2015-08-11 13:13:01,783 ERROR [org.ovirt.engine.core.bll.AddVmCommand] (default task-18) [] Command 'o
rg.ovirt.engine.core.bll.AddVmCommand' failed: CallableStatementCallback; SQL [{call insertvmstatic(?,
 ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
 ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; ER
ROR: duplicate key value violates unique constraint "vm_host_pinning_map_vm_id_key"
  Where: SQL statement "INSERT INTO vm_host_pinning_map(vm_id, vds_id) SELECT  $1 , vds_id FROM fnSpli
tterUuid( $2 ) as vds_id"
PL/pgSQL function "insertdedicatedhoststovm" line 2 at SQL statement
SQL statement "SELECT  InsertDedicatedHostsToVm( $1 ,  $2 )"
PL/pgSQL function "insertvmstatic" line 149 at PERFORM; nested exception is org.postgresql.util.PSQLEx
ception: ERROR: duplicate key value violates unique constraint "vm_host_pinning_map_vm_id_key"
  Where: SQL statement "INSERT INTO vm_host_pinning_map(vm_id, vds_id) SELECT  $1 , vds_id FROM fnSpli
tterUuid( $2 ) as vds_id"
PL/pgSQL function "insertdedicatedhoststovm" line 2 at SQL statement
SQL statement "SELECT  InsertDedicatedHostsToVm( $1 ,  $2 )"
PL/pgSQL function "insertvmstatic" line 149 at PERFORM
2015-08-11 13:13:01,783 ERROR [org.ovirt.engine.core.bll.AddVmCommand] (default task-18) [] Exception:
 org.springframework.dao.DuplicateKeyException: CallableStatementCallback; SQL [{call insertvmstatic(?
, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; E
RROR: duplicate key value violates unique constraint "vm_host_pinning_map_vm_id_key"
  Where: SQL statement "INSERT INTO vm_host_pinning_map(vm_id, vds_id) SELECT  $1 , vds_id FROM fnSpli
tterUuid( $2 ) as vds_id"
PL/pgSQL function "insertdedicatedhoststovm" line 2 at SQL statement
SQL statement "SELECT  InsertDedicatedHostsToVm( $1 ,  $2 )"
PL/pgSQL function "insertvmstatic" line 149 at PERFORM; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "vm_host_pinning_map_vm_id_key"
  Where: SQL statement "INSERT INTO vm_host_pinning_map(vm_id, vds_id) SELECT  $1 , vds_id FROM fnSplitterUuid( $2 ) as vds_id"
PL/pgSQL function "insertdedicatedhoststovm" line 2 at SQL statement
SQL statement "SELECT  InsertDedicatedHostsToVm( $1 ,  $2 )"
PL/pgSQL function "insertvmstatic" line 149 at PERFORM


Expected results:
Vm is created and start running in the specified host.

Additional info:
Happens with the REST API too adding the placement policy:
<vm>
    ...
    <placement_policy>
        <host id="afd7ce7a-b92f-4376-844a-63a0aa195c91"/>
    </placement_policy>
</vm>

Comment 1 Roy Golan 2015-08-11 12:16:20 UTC
that was fixed upstream already

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