Skip to content

KVM: Prevent regenerating keystore on provisionCertificate API - #3075

Merged
nvazquez merged 4 commits into
apache:4.11from
shapeblue:directdownloadkeystoreissue
Jun 5, 2019
Merged

KVM: Prevent regenerating keystore on provisionCertificate API#3075
nvazquez merged 4 commits into
apache:4.11from
shapeblue:directdownloadkeystoreissue

Conversation

@nvazquez

@nvazqueznvazquez commented Dec 2, 2018

Copy link
Copy Markdown
Contributor

Description

It was found out that direct download feature stops working after 'provisionCertificate' API is executed, as both features import certificates into the same /etc/cloudstack/agent/cloud.jks keystore.
The 'provisionCertificate' API invokes a script which regenerates the keystore before adding the new certificate, removing the existing certificates from the keystore. This fix prevents regenerating the keystore before adding the new certificates.

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)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

@yadvr

yadvr commented Dec 3, 2018

Copy link
Copy Markdown
Member

Can we reuse keystore table for this maybe?

Comment threadengine/schema/src/com/cloud/host/dao/HostDaoImpl.java Outdated
@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

1 similar comment
@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@nvazqueznvazquez changed the title Prevent regenerating keystore and add background task to upload certificatesWIP: Prevent regenerating keystore and add background task to upload certificatesFeb 25, 2019
@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3409)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 37252 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3075-t3409-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_iso.py
Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
Intermittent failure detected: /marvin/tests/smoke/test_templates.py
Intermittent failure detected: /marvin/tests/smoke/test_volumes.py
Smoke tests completed. 64 look OK, 4 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_04_extract_IsoFailure1.05test_iso.py
test_05_stop_ssvmError950.85test_ssvm.py
test_06_stop_cpvmError957.93test_ssvm.py
test_07_reboot_ssvmError911.62test_ssvm.py
test_08_reboot_cpvmError912.01test_ssvm.py
test_04_extract_templateFailure1.06test_templates.py
test_06_download_detached_volumeFailure10.27test_volumes.py

@borisstoyanovborisstoyanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nvazquez there seems to be something wrong with the SSVM tests here, can you look when you have time.

@nvazquez

Copy link
Copy Markdown
ContributorAuthor

Sure @borisstoyanov let me take a look later today

@nvazquez
nvazquezforce-pushed the directdownloadkeystoreissue branch from 322ca1a to 35fa34dCompareFebruary 26, 2019 18:29
@nvazquez

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@nvazquez

nvazquez commented Feb 26, 2019

Copy link
Copy Markdown
ContributorAuthor

@borisstoyanov I have rebased the 4.11 branch and tested those files locally without errors on failing tests (results below). It seems to be errors with checksums tests.

test_ssvm.py:

Test List secondary storage VMs ... === TestName: test_01_list_sec_storage_vm | Status : SUCCESS ===
ok
Test List console proxy VMs ... === TestName: test_02_list_cpvm_vm | Status : SUCCESS ===
ok
Test SSVM Internals ... === TestName: test_03_ssvm_internals | Status : SUCCESS ===
ok
Test CPVM Internals ... === TestName: test_04_cpvm_internals | Status : SUCCESS ===
ok
Test stop SSVM ... === TestName: test_05_stop_ssvm | Status : SUCCESS ===
ok
Test stop CPVM ... === TestName: test_06_stop_cpvm | Status : SUCCESS ===
ok
Test reboot SSVM ... === TestName: test_07_reboot_ssvm | Status : SUCCESS ===
ok
Test reboot CPVM ... === TestName: test_08_reboot_cpvm | Status : SUCCESS ===
ok
Test destroy SSVM ... SKIP: Marvin configuration has no host credentials to check router services
Test destroy CPVM ... === TestName: test_10_destroy_cpvm | Status : SUCCESS ===
ok
Test NFS Version on Secondary Storage mounted properly on SSVM ... SKIP: No NFS version provided in test data
----------------------------------------------------------------------
Ran 11 tests in 407.304s
OK (SKIP=2)

test_iso.py, test_templates.py, test_volumes.py:

test_01_1_create_iso_with_checksum_sha1_negative (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_01_1_create_iso_with_checksum_sha1_negative | Status : SUCCESS ===
ok
test_01_create_iso_with_checksum_sha1 (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_01_create_iso_with_checksum_sha1 | Status : SUCCESS ===
ok
test_02_1_create_iso_with_checksum_sha256_negative (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_02_1_create_iso_with_checksum_sha256_negative | Status : SUCCESS ===
ok
test_02_create_iso_with_checksum_sha256 (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_02_create_iso_with_checksum_sha256 | Status : EXCEPTION ===
ERROR
=== TestName: test_02_create_iso_with_checksum_sha256 | Status : EXCEPTION ===
ERROR
test_03_1_create_iso_with_checksum_md5_negative (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_03_1_create_iso_with_checksum_md5_negative | Status : EXCEPTION ===
ERROR
test_03_create_iso_with_checksum_md5 (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_03_create_iso_with_checksum_md5 | Status : SUCCESS ===
ok
test_04_create_iso_with_no_checksum (integration.smoke.test_iso.TestCreateISOWithChecksum) ... === TestName: test_04_create_iso_with_no_checksum | Status : SUCCESS ===
ok
Test create public & private ISO ... === TestName: test_01_create_iso | Status : SUCCESS ===
ok
Test Edit ISO ... === TestName: test_02_edit_iso | Status : SUCCESS ===
ok
Test delete ISO ... === TestName: test_03_delete_iso | Status : SUCCESS ===
ok
Test for extract ISO ... === TestName: test_04_extract_Iso | Status : SUCCESS ===
ok
Update & Test for ISO permissions ... === TestName: test_05_iso_permissions | Status : SUCCESS ===
ok
Test for copy ISO from one zone to another ... SKIP: Not enough zones available to perform copy template
Test delete ISO ... === TestName: test_07_list_default_iso | Status : SUCCESS ===
ok
test_09_copy_delete_template (integration.smoke.test_templates.TestCopyDeleteTemplate) ... SKIP: Skipping test due to there are less than two zones.
Test create public & private template ... === TestName: test_01_create_template | Status : SUCCESS ===
ok
Test when createTemplate is used to create templates having the same name all of them get ... === TestName: test_CreateTemplateWithDuplicateName | Status : SUCCESS ===
ok
test_02_1_create_template_with_checksum_sha1_negative (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_02_1_create_template_with_checksum_sha1_negative | Status : SUCCESS ===
ok
test_02_create_template_with_checksum_sha1 (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_02_create_template_with_checksum_sha1 | Status : EXCEPTION ===
ERROR
test_03_1_create_template_with_checksum_sha256_negative (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_03_1_create_template_with_checksum_sha256_negative | Status : SUCCESS ===
ok
test_03_create_template_with_checksum_sha256 (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_03_create_template_with_checksum_sha256 | Status : SUCCESS ===
ok
test_04_1_create_template_with_checksum_md5_negative (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_04_1_create_template_with_checksum_md5_negative | Status : SUCCESS ===
ok
test_04_create_template_with_checksum_md5 (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_04_create_template_with_checksum_md5 | Status : SUCCESS ===
ok
test_05_create_template_with_no_checksum (integration.smoke.test_templates.TestCreateTemplateWithChecksum) ... === TestName: test_05_create_template_with_no_checksum | Status : SUCCESS ===
ok
Register a template using Direct Download flag ... === TestName: test_01_register_template_direct_download_flag | Status : SUCCESS ===
ok
Deploy a VM from a Direct Download registered template ... === TestName: test_02_deploy_vm_from_direct_download_template | Status : SUCCESS ===
ok
Deploy a VM from a Direct Download registered template with wrong checksum ... === TestName: test_03_deploy_vm_wrong_checksum | Status : SUCCESS ===
ok
Test Edit template ... === TestName: test_02_edit_template | Status : SUCCESS ===
ok
Test delete template ... === TestName: test_03_delete_template | Status : SUCCESS ===
ok
Test for extract template ... === TestName: test_04_extract_template | Status : SUCCESS ===
ok
Update & Test for template permissions ... === TestName: test_05_template_permissions | Status : SUCCESS ===
ok
Test for copy template from one zone to another ... SKIP: Not enough zones available to perform copy template
Test only public templates are visible to normal user ... === TestName: test_07_list_public_templates | Status : SUCCESS ===
ok
Test System templates are not visible to normal user ... === TestName: test_08_list_system_templates | Status : SUCCESS ===
ok
Test Volume creation for all Disk Offerings (incl. custom) ... === TestName: test_01_create_volume | Status : SUCCESS ===
ok
Attach a created Volume to a Running VM ... === TestName: test_02_attach_volume | Status : SUCCESS ===
ok
Download a Volume attached to a VM ... === TestName: test_03_download_attached_volume | Status : SUCCESS ===
ok
Delete a Volume attached to a VM ... === TestName: test_04_delete_attached_volume | Status : SUCCESS ===
ok
Detach a Volume attached to a VM ... === TestName: test_05_detach_volume | Status : SUCCESS ===
ok
Download a Volume unattached to an VM ... === TestName: test_06_download_detached_volume | Status : SUCCESS ===
ok
Test resize (negative) non-existent volume ... === TestName: test_07_resize_fail | Status : SUCCESS ===
ok
Test resize a volume ... === TestName: test_08_resize_volume | Status : SUCCESS ===
ok
Delete a Volume unattached to an VM ... === TestName: test_09_delete_detached_volume | Status : SUCCESS ===
ok
test_10_list_volumes (integration.smoke.test_volumes.TestVolumes) ... === TestName: test_10_list_volumes | Status : SUCCESS ===
ok

@blueorangutan

Copy link
Copy Markdown

@nvazquez unsupported parameters provided. Supported mgmt server os are: centos6, centos7, ubuntu. Supported hypervisors are: kvm-centos6, kvm-centos7, kvm-ubuntu, xenserver-71, xenserver-65sp1, xenserver-62sp1, vmware-65, vmware-60u2, vmware-55u3, vmware-51u1, vmware-50u1

@nvazquez

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3410)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 37431 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3075-t3410-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_iso.py
Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
Intermittent failure detected: /marvin/tests/smoke/test_templates.py
Intermittent failure detected: /marvin/tests/smoke/test_usage.py
Intermittent failure detected: /marvin/tests/smoke/test_volumes.py
Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 64 look OK, 4 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_04_extract_IsoFailure1.08test_iso.py
test_05_stop_ssvmError941.19test_ssvm.py
test_06_stop_cpvmError960.49test_ssvm.py
test_07_reboot_ssvmError912.87test_ssvm.py
test_08_reboot_cpvmError912.91test_ssvm.py
test_05_create_template_with_no_checksumError65.50test_templates.py
test_04_extract_templateFailure1.09test_templates.py
test_06_download_detached_volumeFailure23.77test_volumes.py

@yadvr

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@nvazquez

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@nvazquez

Copy link
Copy Markdown
ContributorAuthor

@rhtyd this is ready for review

fi

# Use a new keystore file
NEW_KS_FILE="$KS_FILE.new"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script was create to be idempotent for jks creation and cert import. I'll have to test concurrent cases and see if this script would pass/fail. I'll test and review today and keep you posted @nvazquez thanks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll also need to test for certificate renewal.

@apacheapache deleted a comment from blueorangutanJun 5, 2019
@apacheapache deleted a comment from blueorangutanJun 5, 2019
@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3645)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41854 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3075-t3645-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 68 look OK, 1 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_05_stop_ssvmError961.34test_ssvm.py
test_06_stop_cpvmError955.20test_ssvm.py
test_07_reboot_ssvmError911.84test_ssvm.py
test_08_reboot_cpvmError910.82test_ssvm.py

Comment threadscripts/util/keystore-setup Outdated
@yadvr
yadvrforce-pushed the directdownloadkeystoreissue branch from 4c9bca6 to 07a550cCompareJune 5, 2019 09:15
yadvr added 2 commits June 5, 2019 16:03
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@yadvr

yadvr commented Jun 5, 2019

Copy link
Copy Markdown
Member

@nvazquez LGTM, I reviewed and fixed few issues around certificate renewal
@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@yadvr
yadvr requested a review from PaulAngusJune 5, 2019 10:59
@blueorangutan

Copy link
Copy Markdown

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

@yadvr

yadvr commented Jun 5, 2019

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@DaanHooglandDaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code changes look good, testing this is done and i'll have to trust that but it is scary ;)

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3650)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 27669 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3075-t3650-kvm-centos7.zip
Smoke tests completed. 69 look OK, 0 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File

@nvazquez

Copy link
Copy Markdown
ContributorAuthor

Thanks for the last fix @rhtyd
Merging after test results and reviews

@nvazquez
nvazquez merged commit d108f32 into apache:4.11Jun 5, 2019
@nvazquez
nvazquez deleted the directdownloadkeystoreissue branch April 6, 2020 14:43
Sign up for freeto 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

@nvazquez@yadvr@borisstoyanov@blueorangutan@anuragaw@DaanHoogland@rafaelweingartner