[
https://issues.apache.org/jira/browse/CLOUDSTACK-3532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sailaja Mada closed CLOUDSTACK-3532.
------------------------------------
Closing the duplicate.
> ConstraintViolationException while deleting the account which has snapshots
> inpgrogress
> ----------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-3532
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3532
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Storage Controller, VMware
> Affects Versions: 4.2.0
> Reporter: Sailaja Mada
> Fix For: 4.2.0
>
> Attachments: apilog.log, management-server.log
>
>
> Steps:
> 1. Configure Advanced Zone with VMWARE (Standard vSwitch)
> 2. Register new template (Cent OS 6.2)
> 3. Create new account and deployed instance with this user
> 4. Add new volume and attached to the instance.
> 5. Tried to create snapshot from this DATA volume . - It failed to create
> snapshot but snapshots creation is in progress
> 6. Tried to delete the account while snapshot is in progress.
> Observation:
> 1. ConstraintViolationException while deleting the accout which has snapshots
> inpgrogress
> 2. Account is happily got removed even there is a issue in deletion of the
> record.
> 2013-07-15 17:02:11,828 DEBUG [cloud.api.ApiServlet] (catalina-exec-7:null)
> ===START=== 10.144.6.19 -- GET
> command=deleteAccount&response=json&sessionkey=qPn9ym6swWoIRJlgcZz8r5glRSA%3D&id=e3e5706f-26c4-48cf-a228-31a1175edfb4&_=1373888142253
> 2013-07-15 17:02:11,997 DEBUG [cloud.async.AsyncJobManagerImpl]
> (catalina-exec-7:null) submit async job-33 = [
> eb291782-dd65-4e36-aa5b-b0161bc79e3e ], details: AsyncJobVO {id:33, userId:
> 2, accountId: 2, sessionKey: null, instanceType: Account, instanceId: null,
> cmd: org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd,
> cmdOriginator: null, cmdInfo:
> {"id":"e3e5706f-26c4-48cf-a228-31a1175edfb4","response":"json","sessionkey":"qPn9ym6swWoIRJlgcZz8r5glRSA\u003d","cmdEventType":"ACCOUNT.DELETE","ctxUserId":"2","httpmethod":"GET","_":"1373888142253","ctxAccountId":"2","ctxStartEventId":"120"},
> cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0,
> processStatus: 0, resultCode: 0, result: null, initMsid: 187767034175903,
> completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
> 2013-07-15 17:02:12,000 DEBUG [cloud.api.ApiServlet] (catalina-exec-7:null)
> ===END=== 10.144.6.19 -- GET
> command=deleteAccount&response=json&sessionkey=qPn9ym6swWoIRJlgcZz8r5glRSA%3D&id=e3e5706f-26c4-48cf-a228-31a1175edfb4&_=1373888142253
> 2013-07-15 17:02:12,005 DEBUG [cloud.async.AsyncJobManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Executing
> org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd for job-33 =
> [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]
> 2013-07-15 17:02:12,239 DEBUG [cloud.user.AccountManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Removed
> account 3
> 2013-07-15 17:02:12,526 DEBUG [agent.transport.Request]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Seq
> 3-84803841: Sending { Cmd , MgmtId: 187767034175903, via: 3, Ver: v1, Flags:
> 100111,
> [{"com.cloud.agent.api.DeleteSnapshotsDirCommand":{"store":{"com.cloud.agent.api.to.NfsTO":{"_url":"nfs://10.102.192.100/cpg_vol/sailaja/vmwaress1","_role":"Image"}},"directory":"snapshots/3/3","wait":0}}]
> }
> 2013-07-15 17:02:12,597 DEBUG [agent.transport.Request]
> (AgentManager-Handler-9:null) Seq 3-84803841: Processing: { Ans: , MgmtId:
> 187767034175903, via: 3, Ver: v1, Flags: 110,
> [{"com.cloud.agent.api.Answer":{"result":false,"details":"failed to delete
> all snapshots
> /mnt/SecStorage/756c37ec-129a-3615-a376-c8f1f77fa7aa/snapshots/3/3/* ,
> err=Failed to delete file
> /mnt/SecStorage/756c37ec-129a-3615-a376-c8f1f77fa7aa/snapshots/3/3/*, err=rm:
> cannot remove
> `/mnt/SecStorage/756c37ec-129a-3615-a376-c8f1f77fa7aa/snapshots/3/3/675977f5-3a61-40d9-bb75-06e458f9bbdf':
> Is a directory","wait":0}}] }
> 2013-07-15 17:02:12,598 DEBUG [agent.manager.AgentAttache]
> (AgentManager-Handler-9:null) Seq 3-84803841: No more commands found
> 2013-07-15 17:02:12,598 DEBUG [agent.transport.Request]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Seq
> 3-84803841: Received: { Ans: , MgmtId: 187767034175903, via: 3, Ver: v1,
> Flags: 110, { Answer } }
> 2013-07-15 17:02:12,598 WARN [storage.snapshot.SnapshotManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Failed to
> delete all snapshot for volume 3 on secondary storage
> nfs://10.102.192.100/cpg_vol/sailaja/vmwaress1
> 2013-07-15 17:02:12,599 ERROR [storage.snapshot.SnapshotManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) failed to
> delete all snapshots
> /mnt/SecStorage/756c37ec-129a-3615-a376-c8f1f77fa7aa/snapshots/3/3/* ,
> err=Failed to delete file
> /mnt/SecStorage/756c37ec-129a-3615-a376-c8f1f77fa7aa/snapshots/3/3/*, err=rm:
> cannot remove
> `/mnt/SecStorage/756c37ec-129a-3615-a376-c8f1f77fa7aa/snapshots/3/3/675977f5-3a61-40d9-bb75-06e458f9bbdf':
> Is a directory
> 2013-07-15 17:02:12,728 DEBUG [db.Transaction.Transaction]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Rolling
> back the transaction: Time = 109 Name =
> -AsyncJobManagerImpl$1.run:494-Executors$RunnableAdapter.call:471-FutureTask$Sync.innerRun:334-FutureTask.run:166-ThreadPoolExecutor.runWorker:1110-ThreadPoolExecutor$Worker.run:603-Thread.run:679;
> called by
> -Transaction.rollback:890-Transaction.removeUpTo:833-Transaction.close:657-TransactionContextBuilder.interceptException:63-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:133-SnapshotManagerImpl.deleteSnapshotDirsForAccount:679-AccountManagerImpl.cleanupAccount:581-AccountManagerImpl.deleteAccount:544-AccountManagerImpl.deleteUserAccount:1272-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:125-RegionManagerImpl.deleteUserAccount:177-RegionServiceImpl.deleteUserAccount:118
> 2013-07-15 17:02:12,755 WARN [cloud.user.AccountManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Failed to
> cleanup account Acct[3-user1] due to
> com.cloud.utils.exception.CloudRuntimeException: DB Exception on:
> com.mysql.jdbc.JDBC4PreparedStatement@37bb7903: DELETE FROM snapshots WHERE
> snapshots.id= 2
> at com.cloud.utils.db.GenericDaoBase.expunge(GenericDaoBase.java:1137)
> at
> com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
> at
> com.cloud.storage.snapshot.SnapshotManagerImpl.deleteSnapshotDirsForAccount(SnapshotManagerImpl.java:679)
> at
> com.cloud.user.AccountManagerImpl.cleanupAccount(AccountManagerImpl.java:581)
> at
> com.cloud.user.AccountManagerImpl.deleteAccount(AccountManagerImpl.java:544)
> at
> com.cloud.user.AccountManagerImpl.deleteUserAccount(AccountManagerImpl.java:1272)
> at
> com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
> at
> org.apache.cloudstack.region.RegionManagerImpl.deleteUserAccount(RegionManagerImpl.java:177)
> at
> org.apache.cloudstack.region.RegionServiceImpl.deleteUserAccount(RegionServiceImpl.java:118)
> at
> org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd.execute(DeleteAccountCmd.java:100)
> at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:158)
> at
> com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:531)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> 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:
> Cannot delete or update a parent row: a foreign key constraint fails
> (`cloud`.`snapshot_store_ref`, CONSTRAINT
> `fk_snapshot_store_ref__snapshot_id` FOREIGN KEY (`snapshot_id`) REFERENCES
> `snapshots` (`id`))
> 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.expunge(GenericDaoBase.java:1128)
> ... 25 more
> 2013-07-15 17:02:12,760 INFO [cloud.user.AccountManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Cleanup
> for account 3 is needed.
> 2013-07-15 17:02:12,820 DEBUG [cloud.async.AsyncJobManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Complete
> async job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ], jobStatus: 1,
> resultCode: 0, result:
> org.apache.cloudstack.api.response.SuccessResponse@501ea2f8
> 2013-07-15 17:02:12,833 DEBUG [cloud.async.AsyncJobManagerImpl]
> (Job-Executor-36:job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]) Done
> executing org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd
> for job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e ]
> 2013-07-15 17:02:15,020 DEBUG [cloud.api.ApiServlet] (catalina-exec-24:null)
> ===START=== 10.144.6.19 -- GET
> command=queryAsyncJobResult&jobId=eb291782-dd65-4e36-aa5b-b0161bc79e3e&response=json&sessionkey=qPn9ym6swWoIRJlgcZz8r5glRSA%3D&_=1373888145444
> 2013-07-15 17:02:15,038 DEBUG [cloud.async.AsyncJobManagerImpl]
> (catalina-exec-24:null) Async job-33 = [ eb291782-dd65-4e36-aa5b-b0161bc79e3e
> ] completed
> 2013-07-15 17:02:15,046 DEBUG [cloud.api.ApiServlet] (catalina-exec-24:null)
> ===END=== 10.144.6.19 -- GET
> command=queryAsyncJobResult&jobId=eb291782-dd65-4e36-aa5b-b0161bc79e3e&response=json&sessionkey=qPn9ym6swWoIRJlgcZz8r5glRSA%3D&_=1373888145444
--
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