cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Allow download of system vm templates

Open GaOrtiga opened this issue 2 years ago • 14 comments

Description

Currently, ACS does not allow the user to download System VM Templates, even though it may be usefull as it can speed up the registration process of the template for production once the homologation is done beforehand. This PR changes this, allowing the user to download said VM Templates

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [X] Minor

How Has This Been Tested?

I built the code with the respective changes in a local lab. After that, I copied the Uuid from one of the System VM templates. Then, using CloudMonkey, I utilized the command 'extract template' with the copied Uuid. CloudMonkey then generated a link for the download of the template, confirming that the alteration was successful.

GaOrtiga avatar Sep 19 '22 19:09 GaOrtiga

Thanks for the PR - can you explain the use case as the systemvmtemplate aren't for public/general consumption for users? The systemvmtemplates are also publicly available so if anybody wants they can register using such links.

rohityadavcloud avatar Sep 20 '22 05:09 rohityadavcloud

@rohityadavcloud Access to the official repositories may be slow at time; therefore, being able to perform a direct download can speed up this process in some use cases. Also since access to these templates is already public, there should be no problem in allowing the downloads to be performed from within the platform itself.

GaOrtiga avatar Sep 20 '22 11:09 GaOrtiga

Codecov Report

Merging #6750 (0aa0dc4) into main (bbc1260) will increase coverage by 0.00%. The diff coverage is 0.00%.

@@            Coverage Diff            @@
##               main    #6750   +/-   ##
=========================================
  Coverage     10.42%   10.42%           
- Complexity     6701     6705    +4     
=========================================
  Files          2458     2458           
  Lines        243246   243244    -2     
  Branches      38067    38066    -1     
=========================================
+ Hits          25358    25366    +8     
+ Misses       214714   214703   -11     
- Partials       3174     3175    +1     
Impacted Files Coverage Δ
...n/java/com/cloud/template/TemplateManagerImpl.java 11.04% <0.00%> (+0.02%) :arrow_up:
...apache/cloudstack/syslog/AlertsSyslogAppender.java 58.75% <0.00%> (+2.25%) :arrow_up:
...dstack/network/contrail/model/ModelObjectBase.java 28.84% <0.00%> (+7.69%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Sep 20 '22 12:09 codecov[bot]

@blueorangutan package

DaanHoogland avatar Sep 20 '22 13:09 DaanHoogland

@DaanHoogland a 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 Sep 20 '22 13:09 blueorangutan

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 4223

blueorangutan avatar Sep 20 '22 14:09 blueorangutan

@blueorangutan test

DaanHoogland avatar Sep 20 '22 17:09 DaanHoogland

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

blueorangutan avatar Sep 20 '22 17:09 blueorangutan

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

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 586.90 test_kubernetes_clusters.py

blueorangutan avatar Sep 21 '22 05:09 blueorangutan

Thanks for the PR - can you explain the use case as the systemvmtemplate aren't for public/general consumption for users? The systemvmtemplates are also publicly available so if anybody wants they can register using such links.

is this a :-1: , @rohityadavcloud ?

DaanHoogland avatar Sep 21 '22 09:09 DaanHoogland

@DaanHoogland no just a question, really trying to understand why we're making this public? (historically this has been private/hidden to users, or at least the download button isn't it?)

rohityadavcloud avatar Sep 21 '22 10:09 rohityadavcloud

@rohityadavcloud it is a valid question but I think @GaOrtiga 's argument makes sense. Do we merge?

DaanHoogland avatar Sep 21 '22 10:09 DaanHoogland

@rohityadavcloud I need to test but i think that the system vm template will not be visible to the normal user so no download button either. Only root admins should be able to download it this way. (not sure about the API) We can verify. Is there any other blocking concern you have?

DaanHoogland avatar Sep 23 '22 06:09 DaanHoogland

@DaanHoogland you are correct, the download button will not be visible in the UI as shown below: image (1)

Furthermore, even through CloudMonkey download will only be available to Root Admins, as shown below: Running the command with a Root Admin account: downloadRootAdmin

Running the command with a user-level account: downloaduser

With this being said, I still do not understand why allowing operators to download said templates is a concern. These images are publicly available, and operators are the ones registering them in ACS. Therefore, it makes sense to allow them to download directly from ACS if they wish so.

GaOrtiga avatar Oct 04 '22 10:10 GaOrtiga

Makes sense, LGTM, let's merge this.

rohityadavcloud avatar Oct 08 '22 06:10 rohityadavcloud