[jira] [Commented] (CLOUDSTACK-7590) Deletion of Account is not deleting the account from the database

2014-09-24 Thread Rahul Rege (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-7590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14146244#comment-14146244
 ] 

Rahul Rege commented on CLOUDSTACK-7590:


I tried to reproduce this on 4.4 first but it works correctly. It does create 
multiple users inside the db with same name on subsequent removal and addition 
of accounts but does not give any error of user already present when its 
removed. I then upgraded to 4.5 and during upgrade itself it failed because I 
had 2 deleted users in the db with same name. So, I had to redeploy the db and 
given that it is not allowing the same username, I am sure it will give the 
error. 

The db schema has changed in 4.5 which has caused this issue and it would fail 
to create a new user with same name and also during upgrades in case you have 
recreated any users in the past on earlier versions, it will not migrate the db 
due to different schema (unless there is another way to do it)

Fixing the db schema seems to be the right choice here than removing the user 
alltogether in case they are using it for some auditing purpose.

 Deletion of Account is not deleting the account from the database
 -

 Key: CLOUDSTACK-7590
 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7590
 Project: CloudStack
  Issue Type: Bug
  Security Level: Public(Anyone can view this level - this is the 
 default.) 
  Components: Management Server
Affects Versions: 4.5.0
Reporter: Chandan Purushothama
Priority: Critical
 Fix For: 4.5.0


 Deletion of account marks the account as removed in the database but doesnt 
 remove the record from the database as shown below:
 mysql select * from account where removed is not null \G
 *** 1. row ***
  id: 7
account_name: CSRegularVPNClientUser
uuid: 96e06a77-fa96-4e38-b380-023d406d445e
type: 0
   domain_id: 1
   state: enabled
 removed: 2014-09-20 00:33:41
  cleanup_needed: 0
  network_domain: NULL
 default_zone_id: NULL
 default: 0
 1 row in set (0.00 sec)
 mysql
 *If anyone wants to recreate the account with the same name. It fails with 
 the below exception:*
 {noformat}
 2014-09-20 00:27:05,880 DEBUG [c.c.u.AccountManagerImpl] 
 (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36 ctx-1b71100c) Creating user: 
 CSRegularVPNClientUser, accountId: 6 timezone:null
 2014-09-20 00:27:05,882 DEBUG [c.c.u.d.T.Transaction] 
 (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36 ctx-1b71100c) Rolling back the 
 transaction: Time = 16 Name =  catalina-exec-11; called by 
 -TransactionLegacy.rollback:902-TransactionLegacy.removeUpTo:845-TransactionLegacy.close:669-TransactionContextInterceptor.invoke:36-ReflectiveMethodInvocation.proceed:161-ExposeInvocationInterceptor.invoke:91-ReflectiveMethodInvocation.proceed:172-JdkDynamicAopProxy.invoke:204-$Proxy67.persist:-1-AccountManagerImpl.createUser:1962-AccountManagerImpl$2.doInTransaction:1039-AccountManagerImpl$2.doInTransaction:1027
 2014-09-20 00:27:05,898 ERROR [c.c.a.ApiServer] 
 (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36 ctx-1b71100c) unhandled exception 
 executing api command: [Ljava.lang.String;@5b4cfa82
 javax.persistence.EntityExistsException: Entity already exists:
 at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1398)
 at com.cloud.user.dao.UserDaoImpl.persist(UserDaoImpl.java:141)
 at com.cloud.user.dao.UserDaoImpl.persist(UserDaoImpl.java:33)
 at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
 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 $Proxy67.persist(Unknown Source)
 at 
 

[jira] [Commented] (CLOUDSTACK-7590) Deletion of Account is not deleting the account from the database

2014-09-24 Thread Rahul Rege (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-7590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14146253#comment-14146253
 ] 

Rahul Rege commented on CLOUDSTACK-7590:


This blocker tracks the schema changes for 4.5

 Deletion of Account is not deleting the account from the database
 -

 Key: CLOUDSTACK-7590
 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7590
 Project: CloudStack
  Issue Type: Bug
  Security Level: Public(Anyone can view this level - this is the 
 default.) 
  Components: Management Server
Affects Versions: 4.5.0
Reporter: Chandan Purushothama
Priority: Critical
 Fix For: 4.5.0


 Deletion of account marks the account as removed in the database but doesnt 
 remove the record from the database as shown below:
 mysql select * from account where removed is not null \G
 *** 1. row ***
  id: 7
account_name: CSRegularVPNClientUser
uuid: 96e06a77-fa96-4e38-b380-023d406d445e
type: 0
   domain_id: 1
   state: enabled
 removed: 2014-09-20 00:33:41
  cleanup_needed: 0
  network_domain: NULL
 default_zone_id: NULL
 default: 0
 1 row in set (0.00 sec)
 mysql
 *If anyone wants to recreate the account with the same name. It fails with 
 the below exception:*
 {noformat}
 2014-09-20 00:27:05,880 DEBUG [c.c.u.AccountManagerImpl] 
 (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36 ctx-1b71100c) Creating user: 
 CSRegularVPNClientUser, accountId: 6 timezone:null
 2014-09-20 00:27:05,882 DEBUG [c.c.u.d.T.Transaction] 
 (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36 ctx-1b71100c) Rolling back the 
 transaction: Time = 16 Name =  catalina-exec-11; called by 
 -TransactionLegacy.rollback:902-TransactionLegacy.removeUpTo:845-TransactionLegacy.close:669-TransactionContextInterceptor.invoke:36-ReflectiveMethodInvocation.proceed:161-ExposeInvocationInterceptor.invoke:91-ReflectiveMethodInvocation.proceed:172-JdkDynamicAopProxy.invoke:204-$Proxy67.persist:-1-AccountManagerImpl.createUser:1962-AccountManagerImpl$2.doInTransaction:1039-AccountManagerImpl$2.doInTransaction:1027
 2014-09-20 00:27:05,898 ERROR [c.c.a.ApiServer] 
 (catalina-exec-11:ctx-bfa880b6 ctx-e82baf36 ctx-1b71100c) unhandled exception 
 executing api command: [Ljava.lang.String;@5b4cfa82
 javax.persistence.EntityExistsException: Entity already exists:
 at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1398)
 at com.cloud.user.dao.UserDaoImpl.persist(UserDaoImpl.java:141)
 at com.cloud.user.dao.UserDaoImpl.persist(UserDaoImpl.java:33)
 at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
 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 $Proxy67.persist(Unknown Source)
 at 
 com.cloud.user.AccountManagerImpl.createUser(AccountManagerImpl.java:1962)
 at 
 com.cloud.user.AccountManagerImpl$2.doInTransaction(AccountManagerImpl.java:1039)
 at 
 com.cloud.user.AccountManagerImpl$2.doInTransaction(AccountManagerImpl.java:1027)
 at 
 com.cloud.utils.db.Transaction$2.doInTransaction(Transaction.java:49)
 at com.cloud.utils.db.Transaction.execute(Transaction.java:37)
 at com.cloud.utils.db.Transaction.execute(Transaction.java:46)
 at 
 com.cloud.user.AccountManagerImpl.createUserAccount(AccountManagerImpl.java:1027)
 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