Bug 809964 - When using ovirt-engine-cli, create network throws exception: "ERROR: null value in column "network_id" violates not-null constraint"
When using ovirt-engine-cli, create network throws exception: "ERROR: null va...
Status: CLOSED NOTABUG
Product: oVirt
Classification: Community
Component: ovirt-engine-cli (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Michael Pasternak
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-04 14:39 EDT by Andrey Falko
Modified: 2014-01-12 19:37 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-06 04:33:59 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Andrey Falko 2012-04-04 14:39:46 EDT
Description of problem:
2012-04-04 18:33:02,466 ERROR [org.ovirt.engine.core.bll.AttachNetworkToVdsGroupCommand] (http--0.0.0.0-8080-2) [32258319] Command org.ovirt.engine.core.bll.AttachNetworkToVdsGroupCommand throw exception: org.springframework.dao.DataIntegrityViolationException: CallableStatementCallback; SQL [{call insertnetwork_cluster(?, ?, ?, ?)}]; ERROR: null value in column "network_id" violates not-null constraint
  Where: SQL statement "INSERT INTO network_cluster(cluster_id, network_id, status, is_display) VALUES( $1 ,  $2 ,  $3 ,  $4 )"
PL/pgSQL function "insertnetwork_cluster" line 2 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: null value in column "network_id" violates not-null constraint
  Where: SQL statement "INSERT INTO network_cluster(cluster_id, network_id, status, is_display) VALUES( $1 ,  $2 ,  $3 ,  $4 )"
PL/pgSQL function "insertnetwork_cluster" line 2 at SQL statement
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:228) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:368) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:342) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:164) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:112) [engine-dal.jar:]
        at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeModification(SimpleJdbcCallsHandler.java:39) [engine-dal.jar:]
        at org.ovirt.engine.core.dao.NetworkClusterDAODbFacadeImpl.save(NetworkClusterDAODbFacadeImpl.java:100) [engine-dal.jar:]
        at org.ovirt.engine.core.bll.AttachNetworkToVdsGroupCommand.createNetworkCluster(AttachNetworkToVdsGroupCommand.java:57) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.AttachNetworkToVdsGroupCommand.executeCommand(AttachNetworkToVdsGroupCommand.java:50) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteWithoutTransaction(CommandBase.java:746) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:838) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1144) [engine-bll.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:204) [engine-utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInRequired(TransactionSupport.java:142) [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:853) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteAction(CommandBase.java:260) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:327) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.RunAction(Backend.java:287) [engine-bll.jar:]
        at sun.reflect.GeneratedMethodAccessor389.invoke(Unknown Source) [:1.6.0_22]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_22]
        at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_22]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.1.Final.jar:]
        at org.ovirt.engine.core.utils.ThreadLocalSessionCleanerInterceptor.injectWebContextToThreadLocal(ThreadLocalSessionCleanerInterceptor.java:11) [engine-utils.jar:]
        at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) [:1.6.0_22]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_22]
        at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_22]
        at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:123) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:53) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:221) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.supports(CMTTxInterceptor.java:367) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:205) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:55) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:]
        at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.0.Beta1b.jar:]
        at org.ovirt.engine.core.common.interfaces.BackendLocal$$$view11.RunAction(Unknown Source) [engine-common.jar:]
        at sun.reflect.GeneratedMethodAccessor449.invoke(Unknown Source) [:1.6.0_22]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_22]
        at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_22]
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) [spring-aop-2.5.6.SEC02.jar:]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198) [spring-aop-2.5.6.SEC02.jar:]
        at $Proxy35.RunAction(Unknown Source)   at org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResource.performCreation(AbstractBackendCollectionResource.java:93)
        at org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResource.performCreation(AbstractBackendCollectionResource.java:132)
        at org.ovirt.engine.api.restapi.resource.BackendClusterNetworksResource.add(BackendClusterNetworksResource.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_22]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.6.0_22]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_22]
        at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_22]
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:151) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:106) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:146) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:91) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.3.GA.jar:]
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.3.GA.jar:]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
        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.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
        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:679) [:1.6.0_22]
Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "network_id" violates not-null constraint
  Where: SQL statement "INSERT INTO network_cluster(cluster_id, network_id, status, is_display) VALUES( $1 ,  $2 ,  $3 ,  $4 )"
PL/pgSQL function "insertnetwork_cluster" line 2 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$5.doInCallableStatement(JdbcTemplate.java:987) [spring-jdbc-2.5.6.SEC02.jar:]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:936) [spring-jdbc-2.5.6.SEC02.jar:]
        ... 99 more

2012-04-04 18:33:02,479 ERROR [org.ovirt.engine.core.bll.AttachNetworkToVdsGroupCommand] (http--0.0.0.0-8080-2) [32258319] Transaction rolled-back for command: org.ovirt.engine.core.bll.AttachNetworkToVdsGroupCommand.
2012-04-04 18:33:02,487 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (http--0.0.0.0-8080-2) Operation Failed: []

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


How reproducible:
create network --data_center-name "a918c089-52b5-494f-9b27-093a2188eb87" --name vmtraffic --cluster-identifier "0a94c8b6-7dfe-11e1-95eb-00219b9af087"

This works: 
create network --data_center-name "a918c089-52b5-494f-9b27-093a2188eb87" --name vmtraffic

Steps to Reproduce:
1. Create datacenter and cluster in datacenter
2. Run create network --data_center-name "a918c089-52b5-494f-9b27-093a2188eb87" --name vmtraffic --cluster-identifier "0a94c8b6-7dfe-11e1-95eb-00219b9af087"

  
Actual results:
unknown error: 
status: 400
reason: Bad Request
detail: []

Expected results:
Network is added and the cluster is attached.

Additional info: Setting severity to high because I can't think of a work-around. I have not been able to get "update network" to work afterwards, but possibly for another reason.
Comment 1 Michael Pasternak 2012-04-06 04:33:59 EDT
well, few problems in your flow:

1. in ovirt/rhevm network added to cluster by two steps:
   a. create network in DC
   b. attach it to cluster
in your example you doing /b/ bypassing /a/

2. in --data_center-name you pass ID => "a918c089-52b5-494f-9b27-093a2188eb87"
   instead of DC name 

since our backend is a restful app. network created and attached in/to
collection using HTTP POST method which in terms of cli is /create/ 
command, i.e

a. create network in DC
=======================

[oVirt shell (connected)]# create network --data_center-name Default_fcp --name my_network

id            : b383e538-e7f5-4e94-bc0a-3a3f1c2bb176
name          : my_network
data_center-id: c747d78b-ee6a-485c-8f81-1b9d46be51e9
display       : False
status-state  : non_operational
stp           : False

b. attach it to cluster
=======================

[oVirt shell (connected)]# create network --data_center-name Default_fcp --name my_network --cluster-identifier Default_fcp

id            : b383e538-e7f5-4e94-bc0a-3a3f1c2bb176
name          : my_network
cluster-id    : 6d62f320-346e-11e1-90fa-174931f86577
data_center-id: c747d78b-ee6a-485c-8f81-1b9d46be51e9
display       : False
status-state  : operational
stp           : False
Comment 2 Michael Pasternak 2012-04-06 04:37:58 EDT
next time please use help, it would give the list option to use
for both create/attach

Note You need to log in before you can comment on or make changes to this bug.