CLOUDSTACK-9341 volume import and export when using swift as secondary storage
ISSUE TYPE
- Bug Report
- Improvement Request
COMPONENT NAME
Secondary Storage
CLOUDSTACK VERSION
4.7 and above
https://issues.apache.org/jira/browse/CLOUDSTACK-9341
CONFIGURATION
CloudStack 4.12, XenServer and Swift as Secondary Storage.
OS / ENVIRONMENT
N/A
SUMMARY
- Uploading a volume fails when using swift as secondary storage. The error returned is: org.apache.cloudstack.storage.to.VolumeObjectTO cannot be cast to org.apache.cloudstack.storage.to.TemplateObjectTO
- Exporting or downloading a volume fails when using swift as secondary storage. Cloudstack shows a url that points to a symlink on the secondary stroage vm however the symlink's path is incorrect path so the volume is not downloaded.
STEPS TO REPRODUCE
- Upload a volume from a url when using swift as secondary storage. This will fail.
- Download a volume when using swift as secondary storage. This will fail.
EXPECTED RESULTS
- Volume is successfully uploaded and eventually gets to ready state.
- A url is shown which points to the volume to download.
ACTUAL RESULTS
- The error returned is:
2021-03-31 20:35:58,497 ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-1:ctx-371ccc91 job-356316) (logid:ff561416) Unexpected exception while executing org.apache.cloudstack.api.command.admin.volume.UploadVolumeCmdByAdmin
java.lang.ClassCastException: org.apache.cloudstack.storage.to.VolumeObjectTO cannot be cast to org.apache.cloudstack.storage.to.TemplateObjectTO
at org.apache.cloudstack.storage.datastore.driver.SwiftImageStoreDriverImpl.createAsync(SwiftImageStoreDriverImpl.java:106)
at org.apache.cloudstack.storage.volume.VolumeServiceImpl.registerVolume(VolumeServiceImpl.java:1676)
at com.cloud.storage.VolumeApiServiceImpl.uploadVolume(VolumeApiServiceImpl.java:307)
at com.cloud.storage.VolumeApiServiceImpl.uploadVolume(VolumeApiServiceImpl.java:182)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.apache.cloudstack.network.contrail.management.EventUtils$EventInterceptor.invoke(EventUtils.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:174)
at com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:174)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy198.uploadVolume(Unknown Source)
at org.apache.cloudstack.api.command.admin.volume.UploadVolumeCmdByAdmin.execute(UploadVolumeCmdByAdmin.java:47)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:156)
at com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:108)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:583)
at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:531)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
- The url shown points at a broken symlink.
@skattoju3 can you add any stacktraces you see in the logs, and possibly from the cloud.log in the ssvm?
hey daan, i've added the stack trace from the management server. It fails before getting to the ssvm...
tnx @skattoju3 , looks like a simple case of mistaken identity, the code assumes only templates are being uploaded and never volumes. Can you verify that uploading a template works, please?
Yes template upload works, however download progress is not reported...
cc @shwstppr @pdion891
Hi, I'm interested in working on this issue. Kindly guide me for the further steps.
Hi, I'm interested in working on this issue. Kindly guide me for the further steps.
@SakshiT25 please see my reply in https://github.com/apache/cloudstack/issues/5686#issuecomment-1274565162