skattoju4 opened a new pull request #4875: URL: https://github.com/apache/cloudstack/pull/4875
### Description This PR is a fix for the data volume import and export functionality when using swift as secondary storage. Background: Secondary storage is used for templates, snapshots and iso's. A data disk is a volume and is meant to reside on primary storage. However, when importing a volume it is first uploaded to secondary storage and then copied to over to primary storage when attached to a VM. Similarly when exporting a volume, it is copied to secondary storage before it is made available to the user for download. When using swift as a secondary storage, an intermediate staging nfs store is needed when copying volumes between primary and secondary storage. This staging nfs store is leveraged for the volume import and export functionality since volumes need not have a footprint on secondary storage. Currently this functionality does not work: When importing a volume the following error is observed: `org.apache.cloudstack.storage.to.VolumeObjectTO cannot be cast to org.apache.cloudstack.storage.to.TemplateObjectTO ` Further investigation reveals that there is no provision in the code to handle import of volumes. Currently only template import is supported. When exporting a volume a URL to the secondary storage is generated but it clicking it does not initiate a download of the exported volume. Further investigation revealed that the url points to a broken symlink which points to an invalid path on the SSVM Use Cases 1. User should be able to import a volume from a URL when using swift as secondary storage and XenServer as the hypervisor. 2. User should be able to export a volume to a secondary storage VM URL when using swift as secondary storage and XenServer as the hypervisor. <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. --> <!-- For new features, provide link to FS, dev ML discussion etc. --> <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. --> <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged --> <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" --> <!-- Fixes: # --> <!--- ********************************************************************************* --> <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ********************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [x] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) ### Feature/Enhancement Scale or Bug Severity This addresses https://github.com/apache/cloudstack/issues/4874 #### Feature/Enhancement Scale - [ ] Major - [*] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [*] Minor - [ ] Trivial ### How Has This Been Tested? <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> <!-- see how your change affects other areas of the code, etc. --> 1. Create data volume (non-managed storage) 2. Attach it to a VM. 3. Create a file system and a test file on the new data volume. 4. Export volume. 5. Upload exported volume to a bucket and generate a URL. 6. Import volume back into CloudStack from URL. 7. Attach imported disk to a VM. 8. Verify previously created test file. <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
