Skip to content

Fix deploy as is VM start after template deletion - #8115

Merged
DaanHoogland merged 3 commits into
apache:4.18from
shapeblue:FixVMstartAfterTemplateDeletion
Nov 14, 2023
Merged

Fix deploy as is VM start after template deletion#8115
DaanHoogland merged 3 commits into
apache:4.18from
shapeblue:FixVMstartAfterTemplateDeletion

Conversation

@harikrishna-patnala

@harikrishna-patnalaharikrishna-patnala commented Oct 18, 2023

Copy link
Copy Markdown
Member

Description

This PR fixes the issue #7970

Fix is to keep the template deploy as is details even after the template is deleted. VM start need to know whether the vapp property is password or not which are saved in template_deploy_as_is_details table.

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)
  • build/CI

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

  1. Registered a VMware template with "Read VM settings from OVA" enabled
  2. Created a VM with it
  3. Force delete the template
  4. Stop and start the VM => succeeded

@harikrishna-patnala
harikrishna-patnalaforce-pushed the FixVMstartAfterTemplateDeletion branch from ed972a7 to 4a78277CompareOctober 18, 2023 09:38
@harikrishna-patnalaharikrishna-patnala added this to the 4.18.2.0 milestone Oct 18, 2023
@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala a [SF] 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.

@weizhouapacheweizhouapache left a comment

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.

code lgtm

I am fine with this change, although this will lead to some records in the database.
I think this is safest way to do, unless we can 100% figure out what details needs to be kept after template is removed.

We probably need to look into the template details as well

 // Remove template details
templateDetailsDao.removeDetails(template.getId());

@DaanHoogland

Copy link
Copy Markdown
Contributor

I think the best way is to copy template details to the ivm_instance_details on deploy

@weizhouapache

Copy link
Copy Markdown
Member

I think the best way is to copy template details to the ivm_instance_details on deploy

@DaanHoogland
it may require some code changes (e.g. read property in vm deploy-as-is details instead of template deploy-as-is details )

@DaanHoogland

Copy link
Copy Markdown
Contributor

I think the best way is to copy template details to the ivm_instance_details on deploy

@DaanHoogland it may require some code changes (e.g. read property in vm deploy-as-is details instead of template deploy-as-is details )

yes, but that would solve the DB remnance. I am not demanding we change this, just suggesting what could be a better design choice.

@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

template_deploy_as_is_details looks like this
image

The corresponding values in user_vm_deploy_as_is_details looks like this
image

So I dont think we can directly copy the template_deploy_as_is_details to user_vm_deploy_as_is_details as it is.
If we have to do that, we need a logic to differentiate the properties entries of templates and their values in the same table "user_vm_deploy_as_is_details", which I'm not sure if it is possible. May be @nvazquez can help here.

Currently we are parsing everything from user_vm_deploy_as_is_details table and passing them to the resource.
https://github.com/shapeblue/cloudstack/blob/4a0636374931e4e6b562def76acb9f8673a7f22a/engine/storage/src/main/java/org/apache/cloudstack/storage/image/deployasis/DeployAsIsHelperImpl.java#L317-L324

To simplify all these, I thought it will be better to keep the template_deploy_as_is_details even after deletion.
Or else like I mentioned in the issue ticket, we need another column in user_vm_deploy_as_is details table which is "is_password", because thats the only field we are looking in template details table.

cc @DaanHoogland@weizhouapache

@harikrishna-patnala
harikrishna-patnalaforce-pushed the FixVMstartAfterTemplateDeletion branch from 7e0ba1e to ebf01daCompareOctober 20, 2023 06:22
@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala 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

Copy link
Copy Markdown

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

@codecov

codecovBot commented Oct 20, 2023

Copy link
Copy Markdown

Codecov Report

Merging #8115 (482a80b) into 4.18 (29c7b31) will increase coverage by 0.04%.
Report is 91 commits behind head on 4.18.
The diff coverage is 18.80%.

@@ Coverage Diff @@## 4.18 #8115 +/- ##
============================================
+ Coverage 13.02% 13.06% +0.04% - Complexity 9032 9108 +76 
============================================
Files 2720 2720 Lines 257080 257547 +467 Branches 40088 40152 +64 ============================================
+ Hits 33476 33655 +179 - Misses 219400 219664 +264 - Partials 4204 4228 +24 
FilesCoverage Δ
...hestration/service/VolumeOrchestrationService.java100.00% <ø> (ø)
.../main/java/com/cloud/network/IpAddressManager.java100.00% <100.00%> (ø)
...ava/com/cloud/network/as/AutoScaleVmProfileVO.java80.20% <100.00%> (+11.66%)⬆️
...java/com/cloud/upgrade/DatabaseUpgradeChecker.java40.89% <100.00%> (+0.64%)⬆️
...va/com/cloud/upgrade/DatabaseVersionHierarchy.java85.10% <100.00%> (+1.01%)⬆️
.../storage/vmsnapshot/StorageVMSnapshotStrategy.java25.39% <ø> (+0.95%)⬆️
.../api/command/admin/ratelimit/ResetApiLimitCmd.java0.00% <ø> (ø)
...oud/hypervisor/kvm/resource/LibvirtConnection.java0.00% <ø> (ø)
.../hypervisor/kvm/storage/ScaleIOStorageAdaptor.java10.44% <100.00%> (ø)
...ava/com/cloud/api/commands/StopNetScalerVMCmd.java0.00% <ø> (ø)
... and 62 more

... and 8 files with indirect coverage changes

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

@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.

some style critique but clgtm

Comment threadserver/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java Outdated
Comment threadserver/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java Outdated
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File

@shwstpprshwstppr 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 LGTM

@shwstppr

Copy link
Copy Markdown
Contributor

@harikrishna-patnala are you making any more changes for review comments?

@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@harikrishna-patnala 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.

@yadvr

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rohityadavcloud 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.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test rocky8 xenserver-71

@blueorangutan

Copy link
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test alma9 vmware-70u3

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + vmware-70u3) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-8148)
Environment: xenserver-71 (x2), Advanced Networking with Mgmt server r8
Total time taken: 40361 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8115-t8148-xenserver-71.zip
Smoke tests completed. 102 look OK, 7 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_03_ping_in_ssvm_successError1.13test_diagnostics.py
test_04_ping_in_ssvm_failureError1.11test_diagnostics.py
test_08_arping_in_ssvmError1.13test_diagnostics.py
test_09_arping_in_cpvmError1.11test_diagnostics.py
test_11_traceroute_in_ssvmError1.11test_diagnostics.py
test_15_retrieve_ssvm_default_filesError1.12test_diagnostics.py
test_16_retrieve_ssvm_single_fileError1.12test_diagnostics.py
test_01_add_primary_storage_disabled_hostError53.29test_primary_storage.py
test_01_non_strict_host_anti_affinityFailure142.91test_nonstrict_affinity_group.py
test_02_non_strict_host_affinityError103.00test_nonstrict_affinity_group.py
test_02_upgrade_kubernetes_clusterFailure579.93test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_clusterFailure268.03test_kubernetes_clusters.py
test_07_deploy_kubernetes_ha_clusterFailure57.76test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_clusterFailure47.29test_kubernetes_clusters.py
test_09_delete_kubernetes_ha_clusterFailure42.16test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_clusterFailure55.16test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_clusterError55.17test_kubernetes_clusters.py
ContextSuite context=TestKubernetesCluster>:teardownError128.26test_kubernetes_clusters.py
test_01_sys_vm_startFailure0.09test_secondary_storage.py
test_01_deploy_vm_on_specific_hostError0.09test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_clusterError1.32test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_podError2.33test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_clusterError0.12test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_podError2.32test_vm_deployment_planner.py
test_08_migrate_vmError0.07test_vm_life_cycle.py

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-8277)

@rajujithrajujith 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.

LGTM. Instance starts fine with this fix although the template (vAPP) is deleted, it was failing earlier. Also observed is that the data is retained in the table template_deploy_as_is_details even after the template deletion as required by this fix. As mentioned already here this has side effects.

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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

Copy link
Copy Markdown

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

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@shwstppr 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

Copy link
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test alma9 vmware-70u3

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + vmware-70u3) has been kicked to run smoke tests

@weizhouapacheweizhouapache left a comment

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.

code lgtm

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-8308)
Environment: vmware-70u3 (x2), Advanced Networking with Mgmt server a9
Total time taken: 46304 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8115-t8308-vmware-70u3.zip
Smoke tests completed. 103 look OK, 6 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_01_add_primary_storage_disabled_hostError35.79test_primary_storage.py
test_01_non_strict_host_anti_affinityFailure149.25test_nonstrict_affinity_group.py
test_02_non_strict_host_affinityError103.05test_nonstrict_affinity_group.py
test_02_upgrade_kubernetes_clusterFailure582.53test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_clusterFailure291.50test_kubernetes_clusters.py
test_07_deploy_kubernetes_ha_clusterFailure92.41test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_clusterFailure57.53test_kubernetes_clusters.py
test_09_delete_kubernetes_ha_clusterFailure57.53test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_clusterError3.48test_kubernetes_clusters.py
ContextSuite context=TestKubernetesCluster>:teardownError82.69test_kubernetes_clusters.py
test_01_sys_vm_startFailure0.09test_secondary_storage.py
test_01_deploy_vm_on_specific_hostError0.08test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_clusterError0.11test_vm_deployment_planner.py
test_03_live_migrate_VM_with_two_data_disksError65.96test_vm_life_cycle.py
test_08_migrate_vmError0.06test_vm_life_cycle.py

@harikrishna-patnala

Copy link
Copy Markdown
MemberAuthor

can this PR be merged, I see the above failures on other PRs also

@DaanHoogland

Copy link
Copy Markdown
Contributor

can this PR be merged, I see the above failures on other PRs also

yes, we shouldn't ignore them, but I am going through them and will add any cleanup or added robustness in #8196

@DaanHoogland
DaanHoogland merged commit b7835d0 into apache:4.18Nov 14, 2023
@DaanHoogland
DaanHoogland deleted the FixVMstartAfterTemplateDeletion branch November 14, 2023 08:32
DaanHoogland added a commit that referenced this pull request Nov 14, 2023
* 4.18:
Fix deploy as is VM start after template deletion (#8115)
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Nov 16, 2023
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Nov 16, 2023
* 4.18:
Fix deploy as is VM start after template deletion (apache#8115)
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.

After force deleting a deploy-as-is template, the VMs using it cannot start

7 participants

@harikrishna-patnala@blueorangutan@DaanHoogland@weizhouapache@shwstppr@yadvr@rajujith