[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-7678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14221565#comment-14221565
 ] 

Min Chen commented on CLOUDSTACK-7678:
--------------------------------------

Before persisting volume in DB, we also use HTTP HEAD method to check if URL is 
inaccessible. If so, report error, and no entry is created and no success job 
is returned.

> volumes are getting  uploaded successfully with wrong url
> ---------------------------------------------------------
>
>                 Key: CLOUDSTACK-7678
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7678
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Volumes
>    Affects Versions: 4.5.0
>            Reporter: prashant kumar mishra
>            Assignee: Min Chen
>             Fix For: 4.5.0
>
>         Attachments: Logs_Db.rar
>
>
> steps to reproduce
> -------------------------
> try to upload a volume with wrong url 
> (ex:http://10.147.28.7/templates/4.2/systemvmtemplate-4.2-vh7.wrong.ova)
> expected
> ------------
> upload volume should fail with error message
> actual
> --------
> volume got uploaded without any error ;volume state=Allocated ,status=empty
> LOG
> ====
> 2014-10-07 14:06:28,065 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (catalina-exec-10:ctx-e194f749 ctx-d4dd2a52) submit async job-578, details: 
> AsyncJobVO {id:578, userId: 2, accountId: 2, instanceType: None, instanceId: 
> null, cmd: 
> org.apache.cloudstack.api.command.admin.volume.UploadVolumeCmdByAdmin, 
> cmdInfo: 
> {"sessionkey":"O23XzQurR1dEYRv5vCw7aueeRKo\u003d","cmdEventType":"VOLUME.UPLOAD","ctxUserId":"2","httpmethod":"GET","format":"OVA","url":"http://10.147.28.7/templates/4.2/systemvmtemplate-4.2-vh7.wrong.ova","zoneId":"41d605d3-1f77-4878-9559-4710a3b1a8f4","response":"json","ctxDetails":"{\"com.cloud.dc.DataCenter\":\"41d605d3-1f77-4878-9559-4710a3b1a8f4\"}","name":"vol","_":"1412670977063","ctxAccountId":"2","ctxStartEventId":"982"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 7407677735140, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-10-07 14:06:28,067 DEBUG [c.c.a.ApiServlet] 
> (catalina-exec-10:ctx-e194f749 ctx-d4dd2a52) ===END===  10.252.193.17 -- GET  
> command=uploadVolume&response=json&sessionkey=O23XzQurR1dEYRv5vCw7aueeRKo%3D&name=vol&zoneId=41d605d3-1f77-4878-9559-4710a3b1a8f4&format=OVA&url=http%3A%2F%2F10.147.28.7%2Ftemplates%2F4.2%2Fsystemvmtemplate-4.2-vh7.wrong.ova&_=1412670977063
> 2014-10-07 14:06:28,082 INFO  [o.a.c.f.j.i.AsyncJobMonitor] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578) Add job-578 into job monitoring
> 2014-10-07 14:06:28,082 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578) Executing AsyncJobVO {id:578, 
> userId: 2, accountId: 2, instanceType: None, instanceId: null, cmd: 
> org.apache.cloudstack.api.command.admin.volume.UploadVolumeCmdByAdmin, 
> cmdInfo: 
> {"sessionkey":"O23XzQurR1dEYRv5vCw7aueeRKo\u003d","cmdEventType":"VOLUME.UPLOAD","ctxUserId":"2","httpmethod":"GET","format":"OVA","url":"http://10.147.28.7/templates/4.2/systemvmtemplate-4.2-vh7.wrong.ova","zoneId":"41d605d3-1f77-4878-9559-4710a3b1a8f4","response":"json","ctxDetails":"{\"com.cloud.dc.DataCenter\":\"41d605d3-1f77-4878-9559-4710a3b1a8f4\"}","name":"vol","_":"1412670977063","ctxAccountId":"2","ctxStartEventId":"982"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 7407677735140, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-10-07 14:06:28,250 DEBUG [c.c.a.m.DirectAgentAttache] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Ping from 1(10.147.40.11)
> 2014-10-07 14:06:28,251 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Process host VM state report from ping 
> process. host: 1
> 2014-10-07 14:06:28,255 INFO  [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Unable to find matched VM in CloudStack 
> DB. name: i-4-20-VM
> 2014-10-07 14:06:28,258 INFO  [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Unable to find matched VM in CloudStack 
> DB. name: i-4-40-VM
> 2014-10-07 14:06:28,277 INFO  [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Unable to find matched VM in CloudStack 
> DB. name: i-4-42-VM
> 2014-10-07 14:06:28,323 INFO  [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Unable to find matched VM in CloudStack 
> DB. name: fa4150b3b46f4386862d37b942a07ca7
> 2014-10-07 14:06:28,401 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Process VM state report. host: 1, 
> number of records in report: 7
> 2014-10-07 14:06:28,404 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 1, 
> power state: PowerOn
> 2014-10-07 14:06:28,419 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 1
> 2014-10-07 14:06:28,419 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 2, 
> power state: PowerOn
> 2014-10-07 14:06:28,437 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 2
> 2014-10-07 14:06:28,437 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 3, 
> power state: PowerOn
> 2014-10-07 14:06:28,451 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 3
> 2014-10-07 14:06:28,452 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 4, 
> power state: PowerOn
> 2014-10-07 14:06:28,485 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 4
> 2014-10-07 14:06:28,485 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 22, 
> power state: PowerOn
> 2014-10-07 14:06:28,502 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 22
> 2014-10-07 14:06:28,502 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 11, 
> power state: PowerOn
> 2014-10-07 14:06:28,518 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 11
> 2014-10-07 14:06:28,518 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM state report. host: 1, vm id: 44, 
> power state: PowerOn
> 2014-10-07 14:06:28,537 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) VM power state does not change, skip DB 
> writing. vm id: 44
> 2014-10-07 14:06:28,581 DEBUG [c.c.v.VirtualMachinePowerStateSyncImpl] 
> (DirectAgentCronJob-436:ctx-fb02db4a) Done with process of VM state report. 
> host: 1
> 2014-10-07 14:06:28,683 DEBUG [o.a.c.s.i.BaseImageStoreDriverImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Downloading volume to 
> data store 1
> 2014-10-07 14:06:28,784 DEBUG [o.a.c.s.RemoteHostEndPoint] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Sending command 
> org.apache.cloudstack.storage.command.DownloadCommand to host: 3
> 2014-10-07 14:06:28,806 DEBUG [c.c.a.t.Request] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Seq 
> 3-8988058956324678768: Sending  { Cmd , MgmtId: 7407677735140, via: 
> 3(s-1-VM), Ver: v1, Flags: 100011, 
> [{"org.apache.cloudstack.storage.command.DownloadCommand":{"hvm":false,"maxDownloadSizeInBytes":536870912000,"id":70,"resourceType":"VOLUME","installPath":"volumes/2/70","_store":{"com.cloud.agent.api.to.NfsTO":{"_url":"nfs://10.147.28.7/export/home/pavan/sxdvmw","_role":"Image"}},"url":"http://10.147.28.7/templates/4.2/systemvmtemplate-4.2-vh7.wrong.ova","format":"OVA","accountId":2,"name":"vol","wait":0}}]
>  }
> 2014-10-07 14:06:28,850 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Complete async 
> job-578, jobStatus: SUCCEEDED, resultCode: 0, result: 
> org.apache.cloudstack.api.response.VolumeResponse/volume/{"id":"7e204de6-5a33-46b1-9f18-70ecc0f089ca","name":"vol","zoneid":"41d605d3-1f77-4878-9559-4710a3b1a8f4","zonename":"xdvmwzone2","type":"DATADISK","provisioningtype":"thin","size":0,"created":"2014-10-07T14:06:28+0530","state":"UploadNotStarted","account":"admin","domainid":"2533836a-4485-11e4-941d-06bcbc0000e4","domain":"ROOT","storagetype":"shared","hypervisor":"VMware","diskofferingid":"0cd97bac-ff1e-4af8-ba4e-7049de33d27c","diskofferingname":"Custom","diskofferingdisplaytext":"Custom
>  
> Disk","destroyed":false,"isextractable":true,"status":"","tags":[],"displayvolume":true,"quiescevm":false}
> 2014-10-07 14:06:28,851 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Publish async job-578 
> complete on message bus
> 2014-10-07 14:06:28,852 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Wake up jobs related 
> to job- 578
> 2014-10-07 14:06:28,852 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Update db status for 
> job- 578
> 2014-10-07 14:06:28,854 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578 ctx-7e4df737) Wake up jobs joined 
> with job- 578 and disjoin all subjobs created from job- 578
> 2014-10-07 14:06:28,860 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-47:ctx-af7d36d6 job-578) Done executing 
> org.apache.cloudstack.api.command.admin.volume.UploadVolumeCmdByAdmin for 
> job-578



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to