Skip to content

Address assignVm regression - #10875

Merged
Pearl1594 merged 3 commits into
apache:4.20from
winterhazel:address-assignvm-regression
May 21, 2025
Merged

Address assignVm regression#10875
Pearl1594 merged 3 commits into
apache:4.20from
winterhazel:address-assignvm-regression

Conversation

@winterhazel

@winterhazelwinterhazel commented May 15, 2025

Copy link
Copy Markdown
Member

Description

This PR fixes#10825 by moving the creation of the network to outside the transaction, right before the updates start happening. This way, if an error happens while creating the network, nothing will have been updated yet. And, if an error happens while updating the virtual machine, the changes will be rolledback.

Also closes#10854.

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)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

I verified that the issue does not happen anymore:

  • I tried to assign the VM to an account without any network: ACS created a new isolated network for the VM and assigned it successfully.

Also, I simulated errors during the VM assignment to verify what would happen:

  • I tried to assign the VM to an account without any network, and forced an error before the creation of the network: the VM remained in its original state, and no network was created;
  • I tried to assign the VM to an account without any network, and forced an error during the creation of the network: the VM remained in its original state, and the creation was rolled-back;
  • I tried to assign the VM to an account without any network, and forced an error while updating the VM's information: the VM was rolled-back to its original state, and the created network was deleted.

And verified the behavior for some other situations:

  • I tried to assign the VM to an account with a single network without selecting the network: the VM was assigned to this single network successfully;
  • I tried to assign the VM to an account with multiple networks without selecting a network: an exception was thrown because I had not selected any network (expected);
  • I tried to assign the VM to an account with multiple networks by selecting one of its networks: the VM was assigned successfully;
  • I moved the VM to a domain-shared network, and tried to assign it to an account from the same domain without any isolated networks: the VM was assigned successfully and remained in the shared network;
  • I moved the VM to an isolated network, and tried to assign it to an account from the same domain that had access only to a domain-shared network: ACS created a new isolated network for the VM and assigned it successfully.

@winterhazel

Copy link
Copy Markdown
MemberAuthor

@Pearl1594 while testing this, I found that there are some problems with the network creation/deletion events in this process. For example, when an isolated network is automatically created by ACS during VM assignment, no creation event is published. However, we can address this issue separately.

@winterhazel

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@codecov

codecovBot commented May 15, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 36.20690% with 37 lines in your changes missing coverage. Please review.

Project coverage is 16.14%. Comparing base (5444261) to head (0306aac).
Report is 1 commits behind head on 4.20.

Files with missing linesPatch %Lines
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java36.20%36 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## 4.20 #10875 +/- ##
=========================================
Coverage 16.13% 16.14% - Complexity 13239 13241 +2 
=========================================
Files 5656 5656 Lines 497579 497615 +36 Branches 60333 60339 +6 =========================================
+ Hits 80297 80316 +19 - Misses 408333 408348 +15 - Partials 8949 8951 +2 
FlagCoverage Δ
uitests4.00% <ø> (ø)
unittests16.99% <36.20%> (+<0.01%)⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan

Copy link
Copy Markdown

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

@shwstppr

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

Comment threadserver/src/main/java/com/cloud/vm/UserVmManagerImpl.java Outdated
@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File

@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

All CI tests assed 👍

@weizhouapacheweizhouapache mentioned this pull request May 16, 2025
12 tasks
Co-authored-by: Wei Zhou <weizhou@apache.org>
@winterhazel

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@winterhazel 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]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13421

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File
ContextSuite context=TestDeployVirtioSCSIVM>:setupError0.00test_deploy_virtio_scsi_vm.py
test_10_bgp_peersError3.33test_ipv4_routing.py
test_11_isolated_network_with_dynamic_routed_modeError124.87test_ipv4_routing.py
test_12_vpc_and_tier_with_dynamic_routed_modeError124.06test_ipv4_routing.py
test_03_update_vm_with_extraconfig_kvmError145.69test_deploy_vm_extra_config_data.py
test_05_basic_lifecycle_kubernetes_clusterFailure135.01test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_clusterFailure3669.50test_kubernetes_clusters.py
test_03_network_operations_on_created_vm_of_otheruserFailure175.93test_network_permissions.py
test_03_network_operations_on_created_vm_of_otheruserError175.94test_network_permissions.py
test_04_deploy_vm_for_other_user_and_test_vm_operationsFailure48.88test_network_permissions.py
ContextSuite context=TestNetworkPermissions>:teardownError1.67test_network_permissions.py
test_reboot_routerError264.49test_network.py
test_01_non_strict_host_anti_affinityError159.17test_nonstrict_affinity_group.py
test_02_non_strict_host_affinityError101.55test_nonstrict_affinity_group.py
test_01_primary_storage_nfsError0.26test_primary_storage.py
ContextSuite context=TestStorageTags>:setupError0.43test_primary_storage.py
test_01_primary_storage_scope_changeError0.15test_primary_storage_scope.py
test_10_project_activationError6.55test_projects.py
test_08_start_routerError1.14test_routers.py
test_09_reboot_routerError1.15test_routers.py
test_10_reboot_router_forcedError1.12test_routers.py
test_04_change_offering_smallError102.77test_service_offerings.py
test_resize_shared_fsError6.58test_sharedfs_lifecycle.py
test_01_list_sec_storage_vmFailure0.04test_ssvm.py
test_03_ssvm_internalsFailure0.06test_ssvm.py
test_05_stop_ssvmFailure0.04test_ssvm.py
test_06_stop_cpvmFailure921.42test_ssvm.py
test_07_reboot_ssvmFailure0.05test_ssvm.py
test_08_reboot_cpvmFailure0.04test_ssvm.py
test_09_reboot_ssvm_forcedFailure0.04test_ssvm.py
test_10_reboot_cpvm_forcedFailure0.05test_ssvm.py
test_11_destroy_ssvmFailure0.04test_ssvm.py
ContextSuite context=TestVMWareStoragePolicies>:setupError0.00test_storage_policy.py
test_01_create_templateError13.64test_templates.py
test_CreateTemplateWithDuplicateNameError23.19test_templates.py
test_02_create_template_with_checksum_sha1Error65.71test_templates.py
test_03_create_template_with_checksum_sha256Error65.70test_templates.py
test_04_create_template_with_checksum_md5Error65.69test_templates.py
test_05_create_template_with_no_checksumError65.69test_templates.py
test_03_delete_templateError1.11test_templates.py
test_04_extract_templateError1.12test_templates.py
test_09_list_templates_download_detailsFailure0.14test_templates.py
ContextSuite context=TestISOUsage>:setupError0.00test_usage.py
test_01_template_usageError11.63test_usage.py
test_01_volume_usageError188.00test_usage.py
test_02_start_vmError4.17test_vm_life_cycle.py
test_03_reboot_vmError0.08test_vm_life_cycle.py
test_04_reboot_vm_forcedFailure1.09test_vm_life_cycle.py
test_10_attachAndDetach_isoFailure1513.41test_vm_life_cycle.py
test_05_vmschedule_test_e2eFailure362.31test_vm_schedule.py
ContextSuite context=TestMigrateVMStrictTags>:setupError0.00test_vm_strict_host_tags.py
ContextSuite context=TestRestoreVMStrictTags>:setupError0.00test_vm_strict_host_tags.py
ContextSuite context=TestScaleVMStrictTags>:setupError0.00test_vm_strict_host_tags.py
ContextSuite context=TestVMDeploymentPlannerStrictTags>:setupError0.00test_vm_strict_host_tags.py
test_04_deploy_vnf_applianceError312.14test_vnf_templates.py
test_02_attach_volumeError80.06test_volumes.py
test_03_download_attached_volumeError11.70test_volumes.py
test_04_delete_attached_volumeError9.54test_volumes.py
test_05_detach_volumeError100.71test_volumes.py
test_06_download_detached_volumeError189.84test_volumes.py
test_06_download_detached_volumeError189.84test_volumes.py
test_07_resize_failError7.49test_volumes.py
test_08_resize_volumeError11.82test_volumes.py
test_09_delete_detached_volumeError10.84test_volumes.py
test_10_list_volumesFailure378.00test_volumes.py
test_10_list_volumesError378.02test_volumes.py
test_11_attach_volume_with_unstarted_vmError107.22test_volumes.py
test_12_resize_volume_with_only_size_parameterError12.82test_volumes.py
test_13_migrate_volume_and_change_offeringError17.22test_volumes.py
test_13_migrate_volume_and_change_offeringError17.22test_volumes.py
test_14_delete_volume_delete_protectionError10.82test_volumes.py
ContextSuite context=TestIpv6Vpc>:setupError0.00test_vpc_ipv6.py
ContextSuite context=TestVPCRedundancy>:setupError0.00test_vpc_redundant.py
ContextSuite context=TestVPCNics>:setupError0.00test_vpc_router_nics.py
ContextSuite context=TestRVPCSite2SiteVpn>:setupError0.00test_vpc_vpn.py
ContextSuite context=TestVPCSite2SiteVPNMultipleOptions>:setupError0.00test_vpc_vpn.py
ContextSuite context=TestVpcRemoteAccessVpn>:setupError0.00test_vpc_vpn.py
ContextSuite context=TestVpcSite2SiteVpn>:setupError0.00test_vpc_vpn.py
test_disable_oobm_ha_state_ineligibleError1517.34test_hostha_kvm.py

@Pearl1594

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-13338)

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan package

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache 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]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13451

@yadvr

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File
test_create_pvlan_networkError0.14test_pvlan.py

@weizhouapache

Copy link
Copy Markdown
Member

verified ok
(same steps in the desciption)

@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File

@Pearl1594
Pearl1594 merged commit 34896a1 into apache:4.20May 21, 2025
@blueorangutan

Copy link
Copy Markdown

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

TestResultTime (s)Test File

dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 19, 2025
* Address assignVm regression
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.

Assign VM operation fails to rollback on network error Failure to assign VM to another account

7 participants

@winterhazel@blueorangutan@shwstppr@weizhouapache@Pearl1594@yadvr@sureshanaparti