[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sanjeev N reopened CLOUDSTACK-3950:
-----------------------------------


With the fix UI doesn't have the copy template/ISO option. 
So if user registers a template with cross zones no (registering template/iso 
in only one particular zone) we see only one entry in template_zone_ref table 
for that particular template even though it is stored at region level.
Now if the user wants to copy ISO to another zone, user doesn't have the option 
to do it through UI with this fix. copying through copyIso api is giving 
success message in the log but not making entry in template_zone_ref table for 
the destination zone. So this template is not available for use in the 
destination zone.

Following is the log snippet for copyIso:

2013-08-20 06:59:14,104 DEBUG [cloud.async.AsyncJobManagerImpl] 
(ApiServer-1:null) submit async job-31 = [ f82a8722-8143-46db-aa6f-89e23fce6f9a 
], details: AsyncJobVO {id:31, userId: 1, accountId: 1, sessionKey: null, 
instanceType: Template, instanceId: 202, cmd: 
org.apache.cloudstack.api.command.user.iso.CopyIsoCmd, cmdOriginator: null, 
cmdInfo: 
{"id":"5bd3325c-e768-4bb1-bcf8-9f1b6074d436","destzoneid":"fbc483e0-4221-4756-93c2-b787957dfa3d","cmdEventType":"TEMPLATE.COPY","ctxUserId":"1","httpmethod":"GET","ctxAccountId":"1","sourcezoneid":"9970aaa4-aa5c-4691-973d-2d92895a33cb","ctxStartEventId":"120"},
 cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
processStatus: 0, resultCode: 0, result: null, initMsid: 6615759585382, 
completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
2013-08-20 06:59:14,116 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-31:job-31 = [ f82a8722-8143-46db-aa6f-89e23fce6f9a ]) Executing 
org.apache.cloudstack.api.command.user.iso.CopyIsoCmd for job-31 = [ 
f82a8722-8143-46db-aa6f-89e23fce6f9a ]
2013-08-20 06:59:14,167 DEBUG [cloud.template.TemplateManagerImpl] 
(Job-Executor-31:job-31 = [ f82a8722-8143-46db-aa6f-89e23fce6f9a ]) There is 
template 202 in secondary storage imagestore in zone 1 , don't need to copy
2013-08-20 06:59:14,183 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-31:job-31 = [ f82a8722-8143-46db-aa6f-89e23fce6f9a ]) Complete 
async job-31 = [ f82a8722-8143-46db-aa6f-89e23fce6f9a ], jobStatus: 1, 
resultCode: 0, result: 
org.apache.cloudstack.api.response.TemplateResponse@cca61b1
2013-08-20 06:59:14,190 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-31:job-31 = [ f82a8722-8143-46db-aa6f-89e23fce6f9a ]) Done 
executing org.apache.cloudstack.api.command.user.iso.CopyIsoCmd for job-31 = [ 
f82a8722-8143-46db-aa6f-89e23fce6f9a ]

zone info:
mysql> select id,name,uuid,networktype from data_center;
+----+---------+--------------------------------------+-------------+
| id | name    | uuid                                 | networktype |
+----+---------+--------------------------------------+-------------+
|  1 | Adv-xen | fbc483e0-4221-4756-93c2-b787957dfa3d | Advanced    |
|  2 | Adv-esx | 9970aaa4-aa5c-4691-973d-2d92895a33cb | Advanced    |
+----+---------+--------------------------------------+-------------+
template registered:
mysql> select id,name,uuid,public,featured,type,removed,cross_zones from 
vm_template where id=202;
+-----+-------+--------------------------------------+--------+----------+------+---------+-------------+
| id  | name  | uuid                                 | public | featured | type 
| removed | cross_zones |
+-----+-------+--------------------------------------+--------+----------+------+---------+-------------+
| 202 | dummy | 5bd3325c-e768-4bb1-bcf8-9f1b6074d436 |      1 |        1 | USER 
| NULL    |           0 |
+-----+-------+--------------------------------------+--------+----------+------+---------+-------------+

mysql> select * from template_zone_ref where template_id=202;
+----+---------+-------------+---------------------+---------------------+---------+
| id | zone_id | template_id | created             | last_updated        | 
removed |
+----+---------+-------------+---------------------+---------------------+---------+
| 19 |       2 |         202 | 2013-08-20 10:41:12 | 2013-08-20 10:41:12 | NULL 
   |
+----+---------+-------------+---------------------+---------------------+---------+

We should not disable the option to copy iso in this case. Even though actual 
copying of the template is not required to another zone we should make entry 
for new zone in template_zone_ref table to make it available in the new zone 
when copied through UI/API.
                
> [UI] Failed to copy region-wide ISO between zones
> -------------------------------------------------
>
>                 Key: CLOUDSTACK-3950
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3950
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: API
>    Affects Versions: 4.2.0
>         Environment: Latest build from ACS 4.2 branch
>            Reporter: Sanjeev N
>            Assignee: Jessica Wang
>            Priority: Critical
>             Fix For: 4.2.0
>
>         Attachments: 2013-08-16-A.jpg, cloud.dmp, cloud.dmp, jessica_1.jpg, 
> jessica_2.jpg, jessica_3.jpg, jessica_4.jpg, management-server.rar
>
>
> Failed to copy ISO between zones
> Steps to Reproduce:
> ================
> 1.Bring up CS with two zones.
> zone1: Advanced with vmware cluster
> zone2: Basic with xen cluster
> 2.Register iso in zone1
> 3.Try to copy iso to zone2
> Result:
> =======
> Copy iso failed with com.cloud.utils.exception.CloudRuntimeException: can't 
> find mapping in ObjectInDataStore table for: 
> org.apache.cloudstack.storage.image.store.TemplateObject@fde83db
> But DownloadProgressCommand shows the downloadstatus as "DOWNLOADED" and 
> "errorString":"Install completed successfully at 7/30/13 12:07 PM"
> Also I see template is copied to secondary storage in zone2. But no entries 
> got created for this copied template in vm_template and template_store_ref.
> Following is the log snippet:
> =======================
> 2013-07-30 08:07:23,216 DEBUG [cloud.api.ApiServlet] (catalina-exec-9:null) 
> ===START===  10.146.0.20 -- GET  
> command=copyIso&id=21c7b14d-e799-4334-b5d6-62f813c2c8fa&sourcezoneid=8605b683-4c48-47d8-941a-b21f28a96b0c&destzoneid=188b12a6-00fe-49b9-b212-931f1d30af1a&response=json&sessionkey=bYZvp3S8yUe%2BpNShiKI3%2BsGhzno%3D&_=1375186043583
> 2013-07-30 08:07:23,248 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (catalina-exec-9:null) submit async job-47 = [ 
> 094edee6-17ce-49ff-89a6-6211ad63f185 ], details: AsyncJobVO {id:47, userId: 
> 2, accountId: 2, sessionKey: null, instanceType: Template, instanceId: 203, 
> cmd: org.apache.cloudstack.api.command.user.iso.CopyIsoCmd, cmdOriginator: 
> null, cmdInfo: 
> {"response":"json","id":"21c7b14d-e799-4334-b5d6-62f813c2c8fa","sessionkey":"bYZvp3S8yUe+pNShiKI3+sGhzno\u003d","destzoneid":"188b12a6-00fe-49b9-b212-931f1d30af1a","cmdEventType":"TEMPLATE.COPY","ctxUserId":"2","httpmethod":"GET","_":"1375186043583","ctxAccountId":"2","sourcezoneid":"8605b683-4c48-47d8-941a-b21f28a96b0c","ctxStartEventId":"173"},
>  cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
> processStatus: 0, resultCode: 0, result: null, initMsid: 6615759585382, 
> completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
> 2013-07-30 08:07:23,251 DEBUG [cloud.api.ApiServlet] (catalina-exec-9:null) 
> ===END===  10.146.0.20 -- GET  
> command=copyIso&id=21c7b14d-e799-4334-b5d6-62f813c2c8fa&sourcezoneid=8605b683-4c48-47d8-941a-b21f28a96b0c&destzoneid=188b12a6-00fe-49b9-b212-931f1d30af1a&response=json&sessionkey=bYZvp3S8yUe%2BpNShiKI3%2BsGhzno%3D&_=1375186043583
> 2013-07-30 08:07:23,255 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) Executing 
> org.apache.cloudstack.api.command.user.iso.CopyIsoCmd for job-47 = [ 
> 094edee6-17ce-49ff-89a6-6211ad63f185 ]
> 2013-07-30 08:07:23,298 DEBUG [storage.image.TemplateDataFactoryImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) template 
> 203 is already in store:1, type:Image
> 2013-07-30 08:07:23,308 DEBUG [storage.image.TemplateDataFactoryImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) template 
> 203 is not in store:2, type:Image
> 2013-07-30 08:07:23,308 DEBUG [storage.image.TemplateServiceImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) Setting 
> source template url to 
> https://10-147-48-3.realhostip.com/copy/SecStorage/21ac712e-6690-39a2-9c7b-cc3d5108db5f/template/tmpl/2/203/203-2-056e10f1-6788-3e3d-85af-f02d2680b8bb.iso
> 2013-07-30 08:07:23,308 DEBUG [storage.image.TemplateServiceImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) Mark 
> template_store_ref entry as Creating
> 2013-07-30 08:07:23,318 DEBUG [storage.image.TemplateDataFactoryImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) template 
> 203 is already in store:2, type:Image
> 2013-07-30 08:07:23,326 DEBUG [storage.image.TemplateServiceImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) Invoke 
> datastore driver createAsync to create template on destination store
> 2013-07-30 08:07:23,340 DEBUG [storage.image.BaseImageStoreDriverImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) 
> Downloading template to data store 2
> 2013-07-30 08:07:23,352 DEBUG [storage.image.BaseImageStoreDriverImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) 
> Performing image store createTemplate async callback
> 2013-07-30 08:07:23,363 INFO  [storage.download.DownloadMonitorImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) abandon 
> obsolete download listener
> 2013-07-30 08:07:23,365 DEBUG [storage.image.BaseImageStoreDriverImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) 
> Performing image store createTemplate async callback
> 2013-07-30 08:07:23,377 DEBUG [storage.image.TemplateServiceImpl] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) 
> Performing copy template cross zone callback after completion
> 2013-07-30 08:07:23,391 DEBUG [cloudstack.storage.RemoteHostEndPoint] 
> (Job-Executor-47:job-47 = [ 094edee6-17ce-49ff-89a6-6211ad63f185 ]) Sending 
> command org.apache.cloudstack.storage.command.DownloadProgressCommand to 
> host: 5
> 2013-07-30 08:07:57,279 DEBUG [image.store.TemplateObject] 
> (RemoteHostEndPoint-1:null) failed to process event and answer
> com.cloud.utils.exception.CloudRuntimeException: can't find mapping in 
> ObjectInDataStore table for: 
> org.apache.cloudstack.storage.image.store.TemplateObject@fde83db
>         at 
> org.apache.cloudstack.storage.datastore.ObjectInDataStoreManagerImpl.update(ObjectInDataStoreManagerImpl.java:239)
>         at 
> org.apache.cloudstack.storage.image.store.TemplateObject.processEvent(TemplateObject.java:210)
>         at 
> org.apache.cloudstack.storage.image.TemplateServiceImpl.copyTemplateCrossZoneCallBack(TemplateServiceImpl.java:677)
>         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:616)
>         at 
> org.apache.cloudstack.framework.async.AsyncCallbackDispatcher.dispatch(AsyncCallbackDispatcher.java:142)
>         at 
> org.apache.cloudstack.framework.async.InplaceAsyncCallbackDriver.performCompletionCallback(InplaceAsyncCallbackDriver.java:26)
>         at 
> org.apache.cloudstack.framework.async.AsyncCallbackDispatcher.complete(AsyncCallbackDispatcher.java:120)
>         at 
> org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl.createTemplateAsyncCallback(BaseImageStoreDriverImpl.java:175)
>         at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:616)
>         at 
> org.apache.cloudstack.framework.async.AsyncCallbackDispatcher.dispatch(AsyncCallbackDispatcher.java:142)
>         at 
> org.apache.cloudstack.framework.async.InplaceAsyncCallbackDriver.performCompletionCallback(InplaceAsyncCallbackDriver.java:26)
>         at 
> org.apache.cloudstack.framework.async.AsyncCallbackDispatcher.complete(AsyncCallbackDispatcher.java:120)
>         at 
> com.cloud.storage.download.DownloadListener.callback(DownloadListener.java:263)
>         at 
> com.cloud.storage.download.DownloadState.onEntry(DownloadState.java:65)
>         at 
> com.cloud.storage.download.DownloadCompleteState.onEntry(DownloadCompleteState.java:38)
>         at 
> com.cloud.storage.download.DownloadListener.transition(DownloadListener.java:252)
>         at 
> com.cloud.storage.download.DownloadListener.processAnswers(DownloadListener.java:236)
>         at 
> com.cloud.storage.upload.UploadListener$Callback.complete(UploadListener.java:477)
>         at 
> com.cloud.storage.upload.UploadListener$Callback.complete(UploadListener.java:466)
>         at 
> org.apache.cloudstack.storage.RemoteHostEndPoint$CmdRunner.run(RemoteHostEndPoint.java:166)
>         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.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
>         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)
> 2013-07-30 08:07:57,283 WARN  
> [storage.datastore.ObjectInDataStoreManagerImpl] (RemoteHostEndPoint-1:null) 
> Template 203 is not found on image store 2, so no need to delete

--
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

Reply via email to