Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDSTACK-10046 checksum validation for any java supported Digests-type #2246

Merged
merged 17 commits into from
Oct 11, 2017

Conversation

DaanHoogland
Copy link
Contributor

This fixes a very old regression where the checksum wouldn't be checked on downloaded templates.

It checks again now but also allows to specify an algorithm like "{SHA-1}98765....". No algorithm assumes md5 ("MD5") for now

@rohityadavcloud
Copy link
Member

@blueorangutan package

@DaanHoogland
Copy link
Contributor Author

@blueorangutan test

@DaanHoogland
Copy link
Contributor Author

@blueorangutan package

@borisstoyanov
Copy link
Contributor

@blueorangutan test

1 similar comment
@DaanHoogland
Copy link
Contributor Author

@blueorangutan test

@borisstoyanov
Copy link
Contributor

@NuxRo Hi, I'm about to create some tests for this and was looking at here: http://dl.openvm.eu/cloudstack/macchinina/x86_64/
are we expecting changes, if no I might hardcode some numbers in tests?

@NuxRo
Copy link
Contributor

NuxRo commented Aug 28, 2017

Hi, I don't plan on making any changes. What exactly do you want to hard code?

@borisstoyanov
Copy link
Contributor

borisstoyanov commented Aug 28, 2017

@NuxRo we need to create tests that verify checksum validation after download. so when registering template we pass the checksum and it checks it when downloaded.

@NuxRo
Copy link
Contributor

NuxRo commented Aug 28, 2017

I am publishing sums here http://dl.openvm.eu/cloudstack/macchinina/x86_64/sha1sum.txt
Can't that be used? Would it help if I upload individual sum files for each file?
Just trying to future-proof a bit.

@borisstoyanov
Copy link
Contributor

we're looking to check not just sha-1 but md5 and sha-256

@NuxRo
Copy link
Contributor

NuxRo commented Aug 28, 2017

All required sums generated, use them if it helps. In any case, I do not see changes coming.

@borisstoyanov
Copy link
Contributor

Thanks @NuxRo !

…n, vmware and kvm hypervisors.

KVM Results:

 Negative Test Passed - Exception Occurred Under template download ['Traceback (most recent call last):\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 189, in test_02_1_create_template_with_checksum_sha1_negative\n    self.download(self.apiclient, template.id)\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 260, in download\n    template.status)\n', 'Exception: Failed to download template: status - Failed post download script: checksum "{sha-1}bf580a13f791d86acf3449a7b457a91a14389264" didn\'t match the given value, "{sha-1}someInvalidValue"\n']
=== TestName: test_02_1_create_template_with_checksum_sha1_negative | Status : SUCCESS ===
=== TestName: test_02_create_template_with_checksum_sha1 | Status : SUCCESS ===.
 Negative Test Passed - Exception Occurred Under template download ['Traceback (most recent call last):\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 203, in test_03_1_create_template_with_checksum_sha256_negative\n    self.download(self.apiclient, template.id)\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 260, in download\n    template.status)\n', 'Exception: Failed to download template: status - Failed post download script: checksum "{SHA-256}efc03633f2b8f5db08acbcc5dc1be9028572dfd8f1c6c8ea663f0ef94b458c5" didn\'t match the given value, "{SHA-256}someInvalidValue"\n']
=== TestName: test_03_1_create_template_with_checksum_sha256_negative | Status : SUCCESS ===
=== TestName: test_03_create_template_with_checksum_sha256 | Status : SUCCESS ===
 Negative Test Passed - Exception Occurred Under template download ['Traceback (most recent call last):\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 217, in test_04_1_create_template_with_checksum_md5_negative\n    self.download(self.apiclient, template.id)\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 260, in download\n    template.status)\n', 'Exception: Failed to download template: status - Failed post download script: checksum "{md5}ada77653dcf1e59495a9e1ac670ad95f" didn\'t match the given value, "{md5}someInvalidValue"\n']
=== TestName: test_04_1_create_template_with_checksum_md5_negative | Status : SUCCESS ===
=== TestName: test_04_create_template_with_checksum_md5 | Status : SUCCESS ===
@borisstoyanov
Copy link
Contributor

borisstoyanov commented Aug 29, 2017

@DaanHoogland I've added tests, can you please resolve the merge conflicts so we can kick tests across hypervisors?

@DaanHoogland
Copy link
Contributor Author

tnx @borisstoyanov will do

DaanHoogland and others added 5 commits August 29, 2017 13:40
…n, vmware and kvm hypervisors.

KVM Results:

 Negative Test Passed - Exception Occurred Under template download ['Traceback (most recent call last):\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 189, in test_02_1_create_template_with_checksum_sha1_negative\n    self.download(self.apiclient, template.id)\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 260, in download\n    template.status)\n', 'Exception: Failed to download template: status - Failed post download script: checksum "{sha-1}bf580a13f791d86acf3449a7b457a91a14389264" didn\'t match the given value, "{sha-1}someInvalidValue"\n']
=== TestName: test_02_1_create_template_with_checksum_sha1_negative | Status : SUCCESS ===
=== TestName: test_02_create_template_with_checksum_sha1 | Status : SUCCESS ===.
 Negative Test Passed - Exception Occurred Under template download ['Traceback (most recent call last):\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 203, in test_03_1_create_template_with_checksum_sha256_negative\n    self.download(self.apiclient, template.id)\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 260, in download\n    template.status)\n', 'Exception: Failed to download template: status - Failed post download script: checksum "{SHA-256}efc03633f2b8f5db08acbcc5dc1be9028572dfd8f1c6c8ea663f0ef94b458c5" didn\'t match the given value, "{SHA-256}someInvalidValue"\n']
=== TestName: test_03_1_create_template_with_checksum_sha256_negative | Status : SUCCESS ===
=== TestName: test_03_create_template_with_checksum_sha256 | Status : SUCCESS ===
 Negative Test Passed - Exception Occurred Under template download ['Traceback (most recent call last):\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 217, in test_04_1_create_template_with_checksum_md5_negative\n    self.download(self.apiclient, template.id)\n', '  File "/Users/bstoyanov/Documents/sb2/cloudstack/test/integration/smoke/test_templates.py", line 260, in download\n    template.status)\n', 'Exception: Failed to download template: status - Failed post download script: checksum "{md5}ada77653dcf1e59495a9e1ac670ad95f" didn\'t match the given value, "{md5}someInvalidValue"\n']
=== TestName: test_04_1_create_template_with_checksum_md5_negative | Status : SUCCESS ===
=== TestName: test_04_create_template_with_checksum_md5 | Status : SUCCESS ===
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@apache apache deleted a comment from blueorangutan Sep 29, 2017
@DaanHoogland
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1123

@DaanHoogland
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-1570)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41481 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2246-t1570-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Test completed. 60 look OK, 2 have error(s)

Test Result Time (s) Test File
test_01_vpc_remote_access_vpn Failure 50.88 test_vpc_vpn.py
test_04_rvpc_privategw_static_routes Failure 568.65 test_privategw_acl.py
test_change_service_offering_for_vm_with_snapshots Skipped 0.00 test_vm_snapshots.py
test_09_copy_delete_template Skipped 0.03 test_templates.py
test_06_copy_template Skipped 0.00 test_templates.py
test_static_role_account_acls Skipped 0.04 test_staticroles.py
test_11_ss_nfs_version_on_ssvm Skipped 0.03 test_ssvm.py
test_01_scale_vm Skipped 0.00 test_scale_vm.py
test_01_primary_storage_iscsi Skipped 0.09 test_primary_storage.py
test_vm_nic_adapter_vmxnet3 Skipped 0.00 test_nic_adapter_type.py
test_nested_virtualization_vmware Skipped 0.00 test_nested_virtualization.py
test_06_copy_iso Skipped 0.00 test_iso.py
test_list_ha_for_host_valid Skipped 0.03 test_hostha_simulator.py
test_list_ha_for_host_invalid Skipped 0.03 test_hostha_simulator.py
test_list_ha_for_host Skipped 0.03 test_hostha_simulator.py
test_hostha_enable_feature_without_setting_provider Skipped 0.03 test_hostha_simulator.py
test_hostha_enable_feature_valid Skipped 0.03 test_hostha_simulator.py
test_hostha_disable_feature_valid Skipped 0.03 test_hostha_simulator.py
test_hostha_configure_invalid_provider Skipped 0.02 test_hostha_simulator.py
test_hostha_configure_default_driver Skipped 0.02 test_hostha_simulator.py
test_ha_verify_fsm_recovering Skipped 0.02 test_hostha_simulator.py
test_ha_verify_fsm_fenced Skipped 0.02 test_hostha_simulator.py
test_ha_verify_fsm_degraded Skipped 0.03 test_hostha_simulator.py
test_ha_verify_fsm_available Skipped 0.03 test_hostha_simulator.py
test_ha_multiple_mgmt_server_ownership Skipped 0.02 test_hostha_simulator.py
test_ha_list_providers Skipped 0.02 test_hostha_simulator.py
test_ha_enable_feature_invalid Skipped 0.03 test_hostha_simulator.py
test_ha_disable_feature_invalid Skipped 0.04 test_hostha_simulator.py
test_ha_configure_enabledisable_across_clusterzones Skipped 0.04 test_hostha_simulator.py
test_configure_ha_provider_valid Skipped 0.03 test_hostha_simulator.py
test_configure_ha_provider_invalid Skipped 0.04 test_hostha_simulator.py
test_deploy_vgpu_enabled_vm Skipped 0.03 test_deploy_vgpu_enabled_vm.py
test_3d_gpu_support Skipped 0.04 test_deploy_vgpu_enabled_vm.py

@DaanHoogland DaanHoogland merged commit ed7811a into apache:master Oct 11, 2017
rohityadavcloud pushed a commit that referenced this pull request Jan 9, 2018
This feature allows using templates and ISOs avoiding secondary storage as intermediate cache on KVM. The virtual machine deployment process is enhanced to supported bypassed registered templates and ISOs, delegating the work of downloading them to primary storage to the KVM agent instead of the SSVM agent.

Template and ISO registration:
- When hypervisor is KVM, a checkbox is displayed with 'Direct Download' label.
- API methods registerTemplate and registerISO are both extended with this new parameter directdownload.
- On template or ISO registration, no download job is sent to SSVM agent, CloudStack would only persist an entry on template_store_ref indicating that template or ISO has been marked as 'Direct Download' (bypassing Secondary Storage). These entries are persisted as:
template_id = Template or ISO id on vm_template table
store_id NULL
download_state = BYPASSED
state = Ready
(Note: these entries allow users to deploy virtual machine from registered templates or ISOs)
- An URL validation command is sent to a random KVM host to check if template/ISO location can be reached. Metalink are also supported by this feature. In case of a metalink, it is fetched and URL check is performed on each of its URLs.
- Checksum should be provided as indicated on #2246: {ALGORITHM}CHKSUMHASH
- After template or ISO is registered, it would be displayed in the UI

Virtual machine deployment:
When a 'Direct Download' template is selected for deployment, CloudStack would delegate template downloading to destination storage pool via destination host by a new pluggable download manager.
Download manager would handle template downloading depending on URL protocol. In case of HTTP, request headers can be set by the user via vm_template_details. Those details should be persisted as:
Key: HTTP_HEADER
Value: HEADERNAME:HEADERVALUE

In case of HTTPS, a new API method is added uploadTemplateDirectDownloadCertificate to allow user importing a client certificate into all KVM hosts' keystore before deployment.
After template or ISO is downloaded to primary storage, usual entry would be persisted on template_spool_ref indicating the mapping between template/ISO and storage pool.
julien-vaz pushed a commit to scclouds/cloudstack that referenced this pull request Feb 18, 2025
Adição de _logs_ na remoção de _hosts_

Closes apache#2246

See merge request scclouds/scclouds!953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants