[ https://issues.apache.org/jira/browse/CLOUDSTACK-7029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sanjay Tripathi reassigned CLOUDSTACK-7029: ------------------------------------------- Assignee: Sanjay Tripathi > listCapacity fails when podid argument is specified > --------------------------------------------------- > > Key: CLOUDSTACK-7029 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7029 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API > Affects Versions: 4.4.0 > Environment: 1 Zone, 1 Pod, 1 Cluster, 1 XS Host > Reporter: Doug Clark > Assignee: Sanjay Tripathi > Priority: Critical > Attachments: management-server.log > > > Calling the listCapacity API specifying the Pod ID results in a DB exception > From apilog.log > {noformat} > 2014-07-01 12:39:07,154 INFO [a.c.c.a.ApiServer] > (catalina-exec-5:ctx-b22b8e7b ctx-19f7ceca ctx-099c67b3) (userId=2 > accountId=2 sessionId=null) 10.80.239.138 -- GET > apiKey=buIo2P4zkk6bxAk2JCutucJFJ1delkqemNhFFatyL-B7lkbROWsmwTJDc1VwNaTgYIrYHXnYgAp7CLPlVrU5vQ&command=listPods&signature=cbkbEaiBVX1i0jI7AKmlf8EUqSY%3D&response=json > 200 { "listpodsresponse" : { "count":1 ,"pod" : [ > {"id":"02c77dca-2420-4392-a907-c59781b2995a","name":"XenRT-Zone-0-Pod-0","zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","gateway":"10.81.40.1","netmask":"255.255.248.0","startip":"10.81.43.185","endip":"10.81.43.194","allocationstate":"Enabled"} > ] } } > 2014-07-01 12:39:19,378 INFO [a.c.c.a.ApiServer] > (catalina-exec-7:ctx-91d92c6b ctx-a47679b5 ctx-9231a22d) (userId=2 > accountId=2 sessionId=null) 10.80.239.138 -- GET > apiKey=buIo2P4zkk6bxAk2JCutucJFJ1delkqemNhFFatyL-B7lkbROWsmwTJDc1VwNaTgYIrYHXnYgAp7CLPlVrU5vQ&podid=02c77dca-2420-4392-a907-c59781b2995a&command=listCapacity&signature=1vSFrwd%2FWU3g76%2BiCVbZuFJ164c%3D&response=json > 530 DB Exception on: SELECT pci, type, SUM(vmcount) FROM (SELECT > MAX(IF(offering.name = 'pciDevice',value,'')) AS pci, MAX(IF(offering.name = > 'vgpuType', value,'')) AS type, COUNT(DISTINCT vm.id) AS vmcount FROM > service_offering_details offering INNER JOIN vm_instance vm ON > offering.service_offering_id = vm.service_offering_id INNER JOIN > `cloud`.`host` ON vm.host_id = host.id WHERE vm.state = 'Running' AND > host.data_center_id = ? AND host.pod_id = ?GROUP BY > offering.service_offering_id) results GROUP BY pci, type > {noformat} > From MS log (attached): > {noformat} > 2014-07-01 12:39:19,355 DEBUG [c.c.a.ApiServlet] > (catalina-exec-7:ctx-91d92c6b) ===START=== 10.80.239.138 -- GET > apiKey=buIo2P4zkk6bxAk2JCutucJFJ1delkqemNhFFatyL-B7lkbROWsmwTJDc1VwNaTgYIrYHXnYgAp7CLPlVrU5vQ&podid=02c77dca-2420-4392-a907-c59781b2995a&command=listCapacity&signature=1vSFrwd%2FWU3g76%2BiCVbZuFJ164c%3D&response=json > 2014-07-01 12:39:19,367 ERROR [c.c.a.ApiServer] (catalina-exec-7:ctx-91d92c6b > ctx-a47679b5 ctx-9231a22d) unhandled exception executing api command: > [Ljava.lang.String;@ff062d > com.cloud.utils.exception.CloudRuntimeException: DB Exception on: SELECT pci, > type, SUM(vmcount) FROM (SELECT MAX(IF(offering.name = 'pciDevice',value,'')) > AS pci, MAX(IF(offering.name = 'vgpuType', value,'')) AS type, COUNT(DISTINCT > vm.id) AS vmcount FROM service_offering_details offering INNER JOIN > vm_instance vm ON offering.service_offering_id = vm.service_offering_id INNER > JOIN `cloud`.`host` ON vm.host_id = host.id WHERE vm.state = 'Running' AND > host.data_center_id = ? AND host.pod_id = ?GROUP BY > offering.service_offering_id) results GROUP BY pci, type > at > com.cloud.vm.dao.VMInstanceDaoImpl.countVgpuVMs(VMInstanceDaoImpl.java:683) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:601) > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) > at > com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) > at $Proxy53.countVgpuVMs(Unknown Source) > at com.cloud.api.ApiDBUtils.getVgpuVmsCount(ApiDBUtils.java:1115) > at > com.cloud.api.ApiResponseHelper.createCapacityResponse(ApiResponseHelper.java:1744) > at > org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd.execute(ListCapacityCmd.java:129) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:141) > at com.cloud.api.ApiServer.queueCommand(ApiServer.java:682) > at com.cloud.api.ApiServer.handleRequest(ApiServer.java:511) > at > com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:330) > at com.cloud.api.ApiServlet.access$000(ApiServlet.java:54) > at com.cloud.api.ApiServlet$1.run(ApiServlet.java:118) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53) > at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:115) > at com.cloud.api.ApiServlet.doGet(ApiServlet.java:77) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) > at > org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:889) > at > org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721) > at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2268) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) > at java.lang.Thread.run(Thread.java:722) > Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You > have an error in your SQL syntax; check the manual that corresponds to your > MySQL server version for the right syntax to use near 'BY > offering.service_offering_id) results GROUP BY pci, type' at line 1 > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:525) > at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) > at com.mysql.jdbc.Util.getInstance(Util.java:386) > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597) > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529) > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990) > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151) > at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625) > at > com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) > at > com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2283) > at > org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) > at > org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) > at > com.cloud.vm.dao.VMInstanceDaoImpl.countVgpuVMs(VMInstanceDaoImpl.java:677) > ... 44 more > 2014-07-01 12:39:19,378 DEBUG [c.c.a.ApiServlet] > (catalina-exec-7:ctx-91d92c6b ctx-a47679b5 ctx-9231a22d) ===END=== > 10.80.239.138 -- GET > apiKey=buIo2P4zkk6bxAk2JCutucJFJ1delkqemNhFFatyL-B7lkbROWsmwTJDc1VwNaTgYIrYHXnYgAp7CLPlVrU5vQ&podid=02c77dca-2420-4392-a907-c59781b2995a&command=listCapacity&signature=1vSFrwd%2FWU3g76%2BiCVbZuFJ164c%3D&response=json > {noformat} > Calling the listCapacity API on the same MS *without specifying the podid* > works fine: > {noformat} > 2014-07-01 12:49:20,189 INFO [a.c.c.a.ApiServer] > (catalina-exec-8:ctx-d50f4ff9 ctx-6b21dcfd ctx-f024eb02) (userId=2 > accountId=2 sessionId=null) 10.80.239.138 -- GET > apiKey=buIo2P4zkk6bxAk2JCutucJFJ1delkqemNhFFatyL-B7lkbROWsmwTJDc1VwNaTgYIrYHXnYgAp7CLPlVrU5vQ&command=listCapacity&signature=Y9LHoNromqwazwRg9B7NxGtNJgY%3D&response=json > 200 { "listcapacityresponse" : { "count":8 ,"capacity" : [ > {"type":0,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":1610612736,"capacitytotal":62251301376,"percentused":"2.59"}, > > {"type":1,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":1000,"capacitytotal":45600,"percentused":"2.19"}, > > {"type":3,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":5242880000,"capacitytotal":101625364480,"percentused":"5.16"}, > > {"type":5,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":6,"capacitytotal":10,"percentused":"60"}, > > {"type":8,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":2,"capacitytotal":15,"percentused":"13.33"}, > > {"type":6,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":179527483392,"capacitytotal":5497558138880,"percentused":"3.27"}, > > {"type":2,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":839647232,"capacitytotal":50812682240,"percentused":"1.65"}, > > {"type":19,"zoneid":"efbfd0c3-e76f-44ef-bbb9-9da1d2117d1a","zonename":"XenRT-Zone-0","capacityused":0,"capacitytotal":0,"percentused":"0"} > ] } } > {noformat} > -- This message was sent by Atlassian JIRA (v6.2#6252)