cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Download Volume Snapshots

Open gpordeus opened this issue 1 year ago • 12 comments

Description

This PR adds the API extractSnapshot so one can download volume snapshots that are backed up on secondary storage.

It checks if extraction is disabled and, if caller has access and the snapshot was found, it returns the download url, in the same way as Template/ISO extraction.

It adds the download_url and download_url_created columns to snapshot_store_ref table and adds a download button to the GUI volume snapshot page.

It also extracts duplicate code of Template/ISO and Volume Extraction around ExtractResponse.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] 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)
  • [ ] build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [X] Minor

Screenshots (if appropriate):

How Has This Been Tested?

I deployed a ubuntu VM, took a volume snapshot and downloaded it through the UI.

I then uploaded the volume to ACS, deployed a new VM, attached the uploaded volume to it so it becomes READY, stopped the VM, detached both volumes, and attached the uploaded volume again, this time as ROOT.

Next, I started the second VM and verified that it was running and that I could access it through the console.

gpordeus avatar Apr 03 '24 17:04 gpordeus

@gpordeus, could you create a PR to add yourself as collaborator (i.e. #8003)? With this, GitHub Actions will run without needing to manually approve the checks for each PR you create.

BryanMLima avatar Apr 03 '24 18:04 BryanMLima

Codecov Report

Attention: Patch coverage is 38.46154% with 72 lines in your changes missing coverage. Please review.

Project coverage is 15.56%. Comparing base (ee39104) to head (5a083b6). Report is 252 commits behind head on main.

Files Patch % Lines
.../api/command/user/snapshot/ExtractSnapshotCmd.java 0.00% 36 Missing :warning:
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 17 Missing :warning:
...tack/storage/datastore/db/SnapshotDataStoreVO.java 7.69% 12 Missing :warning:
.../api/command/user/template/ExtractTemplateCmd.java 0.00% 2 Missing :warning:
api/src/main/java/com/cloud/storage/Upload.java 0.00% 1 Missing :warning:
...cloudstack/api/command/user/iso/ExtractIsoCmd.java 0.00% 1 Missing :warning:
...tack/api/command/user/volume/ExtractVolumeCmd.java 0.00% 1 Missing :warning:
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 1 Missing :warning:
...om/cloud/storage/snapshot/SnapshotManagerImpl.java 97.77% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8878      +/-   ##
============================================
+ Coverage     15.32%   15.56%   +0.24%     
- Complexity    11653    12011     +358     
============================================
  Files          5452     5491      +39     
  Lines        476525   481038    +4513     
  Branches      61192    61735     +543     
============================================
+ Hits          73010    74895    +1885     
- Misses       395447   397858    +2411     
- Partials       8068     8285     +217     
Flag Coverage Δ
uitests 4.20% <ø> (-0.01%) :arrow_down:
unittests 16.32% <38.46%> (+0.25%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 03 '24 18:04 codecov-commenter

@blueorangutan package

DaanHoogland avatar Apr 04 '24 07:04 DaanHoogland

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Apr 04 '24 07:04 blueorangutan

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9150

blueorangutan avatar Apr 04 '24 08:04 blueorangutan

@blueorangutan test

DaanHoogland avatar Apr 04 '24 09:04 DaanHoogland

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar Apr 04 '24 09:04 blueorangutan

[SF] Trillian Build Failed (tid-9694)

blueorangutan avatar Apr 04 '24 11:04 blueorangutan

@blueorangutan test

sureshanaparti avatar Apr 05 '24 13:04 sureshanaparti

@sureshanaparti a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar Apr 05 '24 13:04 blueorangutan

[SF] Trillian test result (tid-9733) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 52117 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8878-t9733-kvm-centos7.zip Smoke tests completed. 129 look OK, 0 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File

blueorangutan avatar Apr 06 '24 04:04 blueorangutan

Can you add unit tests for the new method added?

@RodrigoDLopez Added them, what do you think?

gpordeus avatar Apr 17 '24 20:04 gpordeus

@blueorangutan package

DaanHoogland avatar May 22 '24 08:05 DaanHoogland

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar May 22 '24 08:05 blueorangutan

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9660

blueorangutan avatar May 22 '24 09:05 blueorangutan

@blueorangutan test

DaanHoogland avatar May 22 '24 12:05 DaanHoogland

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar May 22 '24 12:05 blueorangutan

[SF] Trillian test result (tid-10253) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 45717 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8878-t10253-kvm-centos7.zip Smoke tests completed. 130 look OK, 1 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_events_resource Error 417.67 test_events_resource.py

blueorangutan avatar May 23 '24 01:05 blueorangutan

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar May 30 '24 14:05 github-actions[bot]

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Jun 10 '24 05:06 github-actions[bot]

@blueorangutan package

JoaoJandre avatar Jun 10 '24 19:06 JoaoJandre

@JoaoJandre a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Jun 10 '24 19:06 blueorangutan

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9850

blueorangutan avatar Jun 10 '24 20:06 blueorangutan

@DaanHoogland @sureshanaparti @rohityadavcloud could we run the CI here?

JoaoJandre avatar Jun 11 '24 16:06 JoaoJandre

@JoaoJandre , our lab is very busy atm, can it wait till 4.19 is out?

DaanHoogland avatar Jun 12 '24 09:06 DaanHoogland

@blueorangutan package

JoaoJandre avatar Jul 12 '24 13:07 JoaoJandre

@JoaoJandre a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Jul 12 '24 13:07 blueorangutan

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10343

blueorangutan avatar Jul 12 '24 15:07 blueorangutan

@DaanHoogland could we run the CI here?

JoaoJandre avatar Jul 15 '24 13:07 JoaoJandre

@blueorangutan test

sureshanaparti avatar Jul 15 '24 13:07 sureshanaparti