[ https://issues.apache.org/jira/browse/CLOUDSTACK-2284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kishan Kavala reassigned CLOUDSTACK-2284: ----------------------------------------- Assignee: Kishan Kavala > AWS Regions - Not able to add account/domain/user with same Id (External > UUID) after deleting account/domain/user with this id. > ------------------------------------------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-2284 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2284 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Affects Versions: 4.2.0 > Environment: Build from master > Reporter: Sangeetha Hariharan > Assignee: Kishan Kavala > Priority: Critical > Fix For: 4.2.0 > > > AWS Regions - Not able to add account/domain/user with same Id (External > UUID) after deleting account/domain/user with this id. > Steps to reproduce the problem: > 1. Add account/domain/user by passing External uuid in the accountid, userid > and domainid parameter to the createAccount/createDomain/createUser. > 2. Creation of account/domain/user succeeds. > 3. Delete the above created account/domain/user . > 4. Deletion is successful. > 5. Now try to Add account/domain/user by passing the same External uuid ( as > the one in step1 which are now deleted) in the accountid, userid and > domainid parameter to the createAccount/createDomain/createUser > Creation of account/domain/user fails with > api calls: > 2013-04-29 18:49:44,694 INFO [cloud.api.ApiServer] (catalina-exec-5:null) > (userId=2 accountId=2 sessionId=null) 10.223.56 > .66 -- GET > username=test-IUMDSH&domainid=2a50dd26-ad1d-11e2-acc8-068c76000429&firstname=Test&lastname=User&userid=user1&re > sponse=json&apiKey=sSPm7HTehsVp4DQ00Y0SIFaiQ9aabqIX5ty3AzqS2ciu-748BPIexxMfadefR-k3Q9iMCeYxerQ10aSf0h3oUw&command=createAc > count&accounttype=0&signature=mRKIJdxa3mnVWCABrFh57UAkCyI%3D&password=password&email=test%40test.com&accountid=account1 > 20 > 0 { "createaccountresponse" : { "account" : > {"id":"account1","name":"test-IUMDSH","accounttype":0,"domainid":"2a50dd26-ad > 1d-11e2-acc8-068c76000429","domain":"ROOT","vmlimit":"20","vmtotal":0,"vmavailable":"20","iplimit":"20","iptotal":0,"ipava > ilable":"18","volumelimit":"20","volumetotal":0,"volumeavailable":"20","snapshotlimit":"20","snapshottotal":0,"snapshotava > ilable":"20","templatelimit":"20","templatetotal":0,"templateavailable":"20","projectlimit":"Unlimited","projecttotal":0," > projectavailable":"Unlimited","networklimit":"20","networktotal":0,"networkavailable":"20","cpulimit":"40","cputotal":0,"c > puavailable":"40","memorylimit":"40960","memorytotal":0,"memoryavailable":"40960","primarystoragelimit":"200","primarystor > agetotal":0,"primarystorageavailable":"200","secondarystoragelimit":"400","secondarystoragetotal":0,"secondarystorageavail > able":"400","state":"enabled","user":[{"id":"user1","username":"test-IUMDSH","firstname":"Test","lastname":"User","email": > "t...@test.com","created":"2013-04-29T18:49:44-0700","state":"enabled","account":"test-IUMDSH","accounttype":0,"domainid": > "2a50dd26-ad1d-11e2-acc8-068c76000429","domain":"ROOT","accountid":"account1","iscallerchilddomain":false,"isdefault":fals > e,"jobstatus":0}],"isdefault":false,"jobstatus":0} } } > 2013-04-29 20:16:14,970 INFO [cloud.api.ApiServer] (catalina-exec-7:null) > (userId=2 accountId=2 sessionId=null) 10.223.56.66 -- GET > username=test-EEZWQM&domainid=2a50dd26-ad1d-11e2-acc8-068c76000429&firstname=Test&lastname=User&userid=user1&response=json&apiKey=sSPm7HTehsVp4DQ00Y0SIFaiQ9aabqIX5ty3AzqS2ciu-748BPIexxMfadefR-k3Q9iMCeYxerQ10aSf0h3oUw&command=createAccount&accounttype=0&signature=2uJfDxGam6oUI9qsR2tTUGaIOhI%3D&password=password&email=test%40test.com&accountid=account1 > 530 Entity already exists: > 2013-04-29 18:58:03,584 INFO [cloud.api.ApiServer] (catalina-exec-2:null) > (userId=2 accountId=2 sessionId=9F0E4DDB3C5B109C6624B295300677A4) > 10.217.252.128 -- GET > command=deleteAccount&response=json&sessionkey=kVuw1w4mpRqpRWJmCzdR4yUOXKc%3D&id=account1&_=1367287126884 > 200 { "deleteaccountresponse" : > {"jobid":"d4124909-af04-47f8-bfff-818e39ab7eaf"} } > 2013-04-29 20:16:14,970 INFO [cloud.api.ApiServer] (catalina-exec-7:null) > (userId=2 accountId=2 sessionId=null) 10.223.56.66 -- GET > username=test-EEZWQM&domainid=2a50dd26-ad1d-11e2-acc8-068c76000429&firstname=Test&lastname=User&userid=user1&response=json&apiKey=sSPm7HTehsVp4DQ00Y0SIFaiQ9aabqIX5ty3AzqS2ciu-748BPIexxMfadefR-k3Q9iMCeYxerQ10aSf0h3oUw&command=createAccount&accounttype=0&signature=2uJfDxGam6oUI9qsR2tTUGaIOhI%3D&password=password&email=test%40test.com&accountid=account1 > 530 Entity already exists: > mysql> select id,account_name,uuid,removed from account where uuid="account1"; > +----+--------------+----------+---------------------+ > | id | account_name | uuid | removed | > +----+--------------+----------+---------------------+ > | 86 | test-IUMDSH | account1 | 2013-04-30 01:58:03 | > +----+--------------+----------+---------------------+ > 1 row in set (0.00 sec) > Management server logs: > 2013-04-29 20:16:14,952 DEBUG [cloud.api.ApiServlet] (catalina-exec-7:null) > ===START=== 10.223.56.66 -- GET username=tes > t-EEZWQM&domainid=2a50dd26-ad1d-11e2-acc8-068c76000429&firstname=Test&lastname=User&userid=user1&response=json&apiKey=sSPm > 7HTehsVp4DQ00Y0SIFaiQ9aabqIX5ty3AzqS2ciu-748BPIexxMfadefR-k3Q9iMCeYxerQ10aSf0h3oUw&command=createAccount&accounttype=0&sig > nature=2uJfDxGam6oUI9qsR2tTUGaIOhI%3D&email=test%40test.com&accountid=account1 > 2013-04-29 20:16:14,957 DEBUG [cloud.user.AccountManagerImpl] > (catalina-exec-7:null) Access granted to Acct[2-admin] to Do > main:1/ by DomainChecker_EnhancerByCloudStack_a755e199 > 2013-04-29 20:16:14,960 DEBUG [db.Transaction.Transaction] > (catalina-exec-7:null) Rolling back the transaction: Time = 2 N > ame = createUserAccount; called by > -Transaction.rollback:890-Transaction.removeUpTo:833-Transaction.close:657-Transaction > ContextBuilder.interceptException:63-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:133-AccountManage > rImpl.createAccount:1723-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:125-AccountManagerImpl.create > UserAccount:839-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:125-CreateAccountCmd.execute:164-ApiDi > spatcher.dispatch:155-ApiServer.queueCommand:512 > 2013-04-29 20:16:14,967 ERROR [cloud.api.ApiServer] (catalina-exec-7:null) > unhandled exception executing api command: crea > teAccount > javax.persistence.EntityExistsException: Entity already exists: > at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1340) > at > com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstanti > ationPostProcessor.java:125) > at > com.cloud.user.AccountManagerImpl.createAccount(AccountManagerImpl.java:1723) > at > com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstanti > ationPostProcessor.java:125) > at > com.cloud.user.AccountManagerImpl.createUserAccount(AccountManagerImpl.java:839) > at > com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstanti > ationPostProcessor.java:125) > at > org.apache.cloudstack.api.command.admin.account.CreateAccountCmd.execute(CreateAccountCmd.java:164) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:155) > at com.cloud.api.ApiServer.queueCommand(ApiServer.java:512) > at com.cloud.api.ApiServer.handleRequest(ApiServer.java:362) > at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:304) > at com.cloud.api.ApiServlet.doGet(ApiServlet.java:66) > 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:679) > Caused by: > com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: > Duplicate entry 'account1' for key 'uc_account__uuid' > 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:532) > 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:1040) > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074) > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006) > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468) > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629) > at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719) > at > com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) > at > com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450) > at > com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371) > at > com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2355) > at > org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) > at > org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) > at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1305) > ... 40 more > 2013-04-29 20:16:14,970 DEBUG [cloud.api.ApiServlet] (catalina-exec-7:null) > ===END=== 10.223.56.66 -- GET > username=test-EEZWQM&domainid=2a50dd26-ad1d-11e2-acc8-068c76000429&firstname=Test&lastname=User&userid=user1&response=json&apiKey=sSPm7HTehsVp4DQ00Y0SIFaiQ9aabqIX5ty3AzqS2ciu-748BPIexxMfadefR-k3Q9iMCeYxerQ10aSf0h3oUw&command=createAccount&accounttype=0&signature=2uJfDxGam6oUI9qsR2tTUGaIOhI%3D&email=test%40test.com&accountid=account1 -- 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