[ https://issues.apache.org/jira/browse/CLOUDSTACK-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alena Prokharchyk updated CLOUDSTACK-1551: ------------------------------------------ Description: aa40c7ee98b36370069effb68388ba751d7dc6e5 Steps to reproduce (faced on the fresh setup): 1) Added zone, pod. 2) Added new host with the command: 11:58:14,376 INFO Deploy:45 - The command http://localhost:8096/?command=addHost&clustername=alenazone1&hypervisor=xenserver&password=password&podid=1&url=http%3A%2F%2F10.223.79.2&username=root&zoneid=1 passsed The cluster alenazone1 was created automatically 3) Tried to add storage pool to the cluster, but it failed (incorrect mount path was specified in the API) After that listCluster command resulted in NPE: http://localhost:8080/client/api?command=listClusters&response=json&sessionkey=%2BJ9JQhHyFWblhnVYuWO%2BKOG6UF0%3D&page=1&pagesize=1&_=1362604226148 INFO [cloud.api.ApiServer] (ApiServer-4:) Invalid request, no command sent ERROR [cloud.api.ApiServer] (1994818910@qtp-1007211197-20:) unhandled exception executing api command: listClusters java.lang.NullPointerException at com.cloud.api.ApiResponseHelper.createClusterResponse(ApiResponseHelper.java:837) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) at com.cloud.utils.db.TransactionContextBuilder.AroundAnyMethod(TransactionContextBuilder.java:40) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy377.createClusterResponse(Unknown Source) at org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd.execute(ListClustersCmd.java:137) at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) "cluster_details" DB table is empty: mysql> select * from cluster_details; Empty set (0.00 sec) "cluster" table has an entry: mysql> select * from cluster; +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ | id | name | uuid | guid | pod_id | data_center_id | hypervisor_type | cluster_type | allocation_state | managed_state | removed | owner | created | lastUpdated | engine_state | +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ | 1 | alenazone1 | 8858f907-731a-46b7-982e-f5fbe6fddb5d | be15d332-a3a6-c4c7-32af-8185fdf31888 | 1 | 1 | xenserver | CloudManaged | Enabled | Managed | NULL | NULL | NULL | NULL | Disabled | +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ 1 row in set (0.00 sec) The only one host in the cluster is up: mysql> select id, name, status from host where id=2; +----+---------------+--------+ | id | name | status | +----+---------------+--------+ | 2 | xenserver-min | Up | +----+---------------+--------+ 1 row in set (0.00 sec) NPE happened because api layer tries to retrieve cluster details assuming that they are always in cluster_details table. was: aa40c7ee98b36370069effb68388ba751d7dc6e5 Steps to reproduce (faced on the fresh setup): 1) Added zone, pod and new cluster. 2) Added new host to the cluster 3) Tried to add storage pool to the cluster, but it failed (incorrect mount path was specified in the API) After that listCluster command resulted in NPE: http://localhost:8080/client/api?command=listClusters&response=json&sessionkey=%2BJ9JQhHyFWblhnVYuWO%2BKOG6UF0%3D&page=1&pagesize=1&_=1362604226148 INFO [cloud.api.ApiServer] (ApiServer-4:) Invalid request, no command sent ERROR [cloud.api.ApiServer] (1994818910@qtp-1007211197-20:) unhandled exception executing api command: listClusters java.lang.NullPointerException at com.cloud.api.ApiResponseHelper.createClusterResponse(ApiResponseHelper.java:837) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) at com.cloud.utils.db.TransactionContextBuilder.AroundAnyMethod(TransactionContextBuilder.java:40) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy377.createClusterResponse(Unknown Source) at org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd.execute(ListClustersCmd.java:137) at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) "cluster_details" DB table is empty: mysql> select * from cluster_details; Empty set (0.00 sec) "cluster" table has an entry: mysql> select * from cluster; +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ | id | name | uuid | guid | pod_id | data_center_id | hypervisor_type | cluster_type | allocation_state | managed_state | removed | owner | created | lastUpdated | engine_state | +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ | 1 | alenazone1 | 8858f907-731a-46b7-982e-f5fbe6fddb5d | be15d332-a3a6-c4c7-32af-8185fdf31888 | 1 | 1 | xenserver | CloudManaged | Enabled | Managed | NULL | NULL | NULL | NULL | Disabled | +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ 1 row in set (0.00 sec) The only one host in the cluster is up: mysql> select id, name, status from host where id=2; +----+---------------+--------+ | id | name | status | +----+---------------+--------+ | 2 | xenserver-min | Up | +----+---------------+--------+ 1 row in set (0.00 sec) NPE happened because api layer tries to retrieve cluster details assuming that they are always in cluster_details table. Summary: Failed to list clusters due to NPE at createClusterResponse(ApiResponseHelper.java:837) when cluster is added automatically as a part of addHostCommand (was: Failed to list clusters due to NPE at createClusterResponse(ApiResponseHelper.java:837)) The problem happens when the cluster is created as a part of addHost command. In this case no details are added to cluster_details table. This problem doesn't occur when the cluster is added explicitly with addCluster API > Failed to list clusters due to NPE at > createClusterResponse(ApiResponseHelper.java:837) when cluster is added > automatically as a part of addHostCommand > ------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-1551 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-1551 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API > Affects Versions: 4.2.0 > Reporter: Alena Prokharchyk > Assignee: Bharat Kumar > Fix For: 4.2.0 > > > aa40c7ee98b36370069effb68388ba751d7dc6e5 > Steps to reproduce (faced on the fresh setup): > 1) Added zone, pod. > 2) Added new host with the command: > 11:58:14,376 INFO Deploy:45 - The command > http://localhost:8096/?command=addHost&clustername=alenazone1&hypervisor=xenserver&password=password&podid=1&url=http%3A%2F%2F10.223.79.2&username=root&zoneid=1 > passsed > The cluster alenazone1 was created automatically > 3) Tried to add storage pool to the cluster, but it failed (incorrect mount > path was specified in the API) > After that listCluster command resulted in NPE: > http://localhost:8080/client/api?command=listClusters&response=json&sessionkey=%2BJ9JQhHyFWblhnVYuWO%2BKOG6UF0%3D&page=1&pagesize=1&_=1362604226148 > INFO [cloud.api.ApiServer] (ApiServer-4:) Invalid request, no command sent > ERROR [cloud.api.ApiServer] (1994818910@qtp-1007211197-20:) unhandled > exception executing api command: listClusters > java.lang.NullPointerException > at > com.cloud.api.ApiResponseHelper.createClusterResponse(ApiResponseHelper.java:837) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) > at > org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) > at > com.cloud.utils.db.TransactionContextBuilder.AroundAnyMethod(TransactionContextBuilder.java:40) > at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) > at > org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) > at > org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) > at $Proxy377.createClusterResponse(Unknown Source) > at > org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd.execute(ListClustersCmd.java:137) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:163) > at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) > "cluster_details" DB table is empty: > mysql> select * from cluster_details; > Empty set (0.00 sec) > "cluster" table has an entry: > mysql> select * from cluster; > +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ > | id | name | uuid | guid > | pod_id | data_center_id | hypervisor_type | cluster_type > | allocation_state | managed_state | removed | owner | created | lastUpdated > | engine_state | > +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ > | 1 | alenazone1 | 8858f907-731a-46b7-982e-f5fbe6fddb5d | > be15d332-a3a6-c4c7-32af-8185fdf31888 | 1 | 1 | xenserver > | CloudManaged | Enabled | Managed | NULL | NULL | NULL > | NULL | Disabled | > +----+------------+--------------------------------------+--------------------------------------+--------+----------------+-----------------+--------------+------------------+---------------+---------+-------+---------+-------------+--------------+ > 1 row in set (0.00 sec) > The only one host in the cluster is up: > mysql> select id, name, status from host where id=2; > +----+---------------+--------+ > | id | name | status | > +----+---------------+--------+ > | 2 | xenserver-min | Up | > +----+---------------+--------+ > 1 row in set (0.00 sec) > NPE happened because api layer tries to retrieve cluster details assuming > that they are always in cluster_details table. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira