[ https://issues.apache.org/jira/browse/CLOUDSTACK-2584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Min Chen resolved CLOUDSTACK-2584. ---------------------------------- Resolution: Fixed Fixed with both commits. > [Object_Store_Refactor] Failed to create template from stopped guest vm's > root disk > ----------------------------------------------------------------------------------- > > Key: CLOUDSTACK-2584 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2584 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Template > Affects Versions: 4.2.0 > Environment: Build from object_store branch > Reporter: Sanjeev N > Assignee: edison su > Priority: Critical > Fix For: 4.2.0 > > Attachments: management-server.rar > > > [Object_Store_Refactor] Failed to create template from stopped guest vm's > root disk > Steps to reproduce: > ================ > 1.Bring up CS in advanced zone with S3 as the secondary storage provider > 2.Deploy guest vm with default cent os template downloaded after system vms > are up > 3.Stop the guest vm and try to take template from the root volume of the > guest vm deployed above > Observations: > ============ > Observed following exception while taking template: > 2013-05-20 12:33:23,481 DEBUG [cloud.api.ApiServlet] (catalina-exec-15:null) > ===START=== 10.146.0.15 -- GET > command=createTemplate&response=json&sessionkey=R6B02dSeoRFzL6CVp2PX3UbfsGg%3D&volumeId=135a3df1-20e1-4b4b-a433-86976ddc9218&name=root3&displayText=root3&osTypeId=6d6b2f3e-c0bf-11e2-8198-06ab4600005f&isPublic=true&passwordEnabled=false&isfeatured=true&_=1369047892340 > 2013-05-20 12:33:23,711 DEBUG [cloud.template.TemplateManagerImpl] > (catalina-exec-15:null) This template is getting created from other template, > setting source template Id to: 5 > 2013-05-20 12:33:23,763 DEBUG [cloud.async.AsyncJobManagerImpl] > (catalina-exec-15:null) submit async job-19, details: AsyncJobVO {id:19, > userId: 2, accountId: 2, sessionKey: null, instanceType: Template, > instanceId: 205, cmd: > org.apache.cloudstack.api.command.user.template.CreateTemplateCmd, > cmdOriginator: null, cmdInfo: > {"sessionkey":"R6B02dSeoRFzL6CVp2PX3UbfsGg\u003d","volumeId":"135a3df1-20e1-4b4b-a433-86976ddc9218","ctxUserId":"2","httpmethod":"GET","osTypeId":"6d6b2f3e-c0bf-11e2-8198-06ab4600005f","isPublic":"true","isfeatured":"true","response":"json","id":"205","displayText":"root3","passwordEnabled":"false","name":"root3","_":"1369047892340","ctxAccountId":"2","ctxStartEventId":"75"}, > cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, > processStatus: 0, resultCode: 0, result: null, initMsid: 7332683579487, > completeMsid: null, lastUpdated: null, lastPolled: null, created: null} > 2013-05-20 12:33:23,766 DEBUG [cloud.api.ApiServlet] (catalina-exec-15:null) > ===END=== 10.146.0.15 -- GET > command=createTemplate&response=json&sessionkey=R6B02dSeoRFzL6CVp2PX3UbfsGg%3D&volumeId=135a3df1-20e1-4b4b-a433-86976ddc9218&name=root3&displayText=root3&osTypeId=6d6b2f3e-c0bf-11e2-8198-06ab4600005f&isPublic=true&passwordEnabled=false&isfeatured=true&_=1369047892340 > 2013-05-20 12:33:23,774 DEBUG [cloud.async.AsyncJobManagerImpl] > (Job-Executor-6:job-19) Executing > org.apache.cloudstack.api.command.user.template.CreateTemplateCmd for job-19 > 2013-05-20 12:33:23,853 DEBUG [cloud.template.TemplateManagerImpl] > (Job-Executor-6:job-19) Failed to create > templatecom.cloud.utils.exception.CloudRuntimeException: Can't find cache > storage in zone: null > 2013-05-20 12:33:23,857 DEBUG [db.Transaction.Transaction] > (Job-Executor-6:job-19) Rolling back the transaction: Time = 3 Name = > -AsyncJobManagerImpl$1.run:401-Executors$RunnableAdapter.call:471-FutureTask$Sync.innerRun:334-FutureTask.run:166-ThreadPoolExecutor.runWorker:1146-ThreadPoolExecutor$Worker.run:615-Thread.run:679; > called by > -Transaction.rollback:890-Transaction.removeUpTo:833-Transaction.close:657-TransactionContextBuilder.interceptException:63-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:133-TemplateManagerImpl.createPrivateTemplate:1433-ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:125-CreateTemplateCmd.execute:258-ApiDispatcher.dispatch:155-AsyncJobManagerImpl$1.run:437-Executors$RunnableAdapter.call:471-FutureTask$Sync.innerRun:334 > 2013-05-20 12:33:23,867 ERROR [cloud.async.AsyncJobManagerImpl] > (Job-Executor-6:job-19) Unexpected exception while executing > org.apache.cloudstack.api.command.user.template.CreateTemplateCmd > com.cloud.utils.exception.CloudRuntimeException: DB Exception on: > com.mysql.jdbc.JDBC4PreparedStatement@6265c4a7: DELETE FROM vm_template WHERE > vm_template.id= 205 > at com.cloud.utils.db.GenericDaoBase.expunge(GenericDaoBase.java:1137) > at > com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125) > at > com.cloud.template.TemplateManagerImpl.createPrivateTemplate(TemplateManagerImpl.java:1433) > at > com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125) > at > org.apache.cloudstack.api.command.user.template.CreateTemplateCmd.execute(CreateTemplateCmd.java:258) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:155) > at > com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:437) > 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:1146) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > 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`.`template_store_ref`, CONSTRAINT > `fk_template_store_ref__template_id` FOREIGN KEY (`template_id`) REFERENCES > `vm_template` (`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) > ... 20 more > 2013-05-20 12:33:23,870 DEBUG [cloud.async.AsyncJobManagerImpl] > (Job-Executor-6:job-19) Complete async job-19, jobStatus: 2, resultCode: 530, > result: Error Code: 530 Error text: DB Exception on: > com.mysql.jdbc.JDBC4PreparedStatement@6265c4a7: DELETE FROM vm_template WHERE > vm_template.id= 205 > 2.Even though the template creation failed, I could see template state as > Allocated in vm_template and template_store_ref tables: > mysql> select * from vm_template where id=205\G; > *************************** 1. row *************************** > id: 205 > unique_name: 25a63a226-e490-3bc7-885e-fb9c83464397 > name: root3 > uuid: 088f76b9-1765-4eac-bdc6-8d51716cf9d5 > public: 1 > featured: 1 > type: USER > hvm: 1 > bits: 64 > url: NULL > format: RAW > created: 2013-05-20 16:33:23 > removed: NULL > account_id: 2 > checksum: NULL > display_text: root3 > enable_password: 0 > enable_sshkey: 0 > guest_os_id: 142 > bootable: 1 > prepopulate: 0 > cross_zones: 0 > extractable: 1 > hypervisor_type: XenServer > source_template_id: 5 > template_tag: NULL > sort_key: 0 > size: NULL > state: Allocated > update_count: 2 > updated: 2013-05-20 16:33:23 > 1 row in set (0.00 sec) > ERROR: > No query specified > mysql> select * from template_store_ref where template_id=205\G; > *************************** 1. row *************************** > id: 12 > store_id: 1 > template_id: 205 > created: 2013-05-20 16:33:23 > last_updated: NULL > job_id: NULL > download_pct: 0 > size: 0 > store_role: Image > physical_size: 0 > download_state: NULL > error_str: NULL > local_path: NULL > install_path: template/tmpl/2/205 > url: NULL > state: Allocated > destroyed: 0 > is_copy: 0 > update_count: 2 > updated: 2013-05-20 16:33:23 > 1 row in set (0.00 sec) > ERROR: > No query specified > -- 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