cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

synchronise VM creation to guard resource limit

Open DaanHoogland opened this issue 3 years ago • 16 comments
trafficstars

Description

This PR makes sure a user can not create multiple VMs at once thus going passed their resource limit. For this purpose the part between the resource limit check and the commit of the VM has been put in a synchronized method.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] 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

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [x] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

DaanHoogland avatar Aug 09 '22 09:08 DaanHoogland

@harikrishna-patnala @shwstppr If you guys feel this should go in 4.17.1 I can rebase (after some more cleaning.

DaanHoogland avatar Aug 09 '22 09:08 DaanHoogland

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar Aug 09 '22 12:08 acs-robot

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar Aug 09 '22 13:08 acs-robot

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Aug 09 '22 15:08 github-actions[bot]

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar Aug 09 '22 15:08 acs-robot

Codecov Report

Merging #6619 (ea42907) into main (152a274) will increase coverage by 0.00%. The diff coverage is n/a.

:exclamation: Current head ea42907 differs from pull request most recent head d694871. Consider uploading reports for the commit d694871 to get more accurate results

@@            Coverage Diff             @@
##               main    #6619    +/-   ##
==========================================
  Coverage      5.87%    5.87%            
- Complexity     3933     3935     +2     
==========================================
  Files          2454     2454            
  Lines        242633   242468   -165     
  Branches      37970    37931    -39     
==========================================
+ Hits          14246    14250     +4     
+ Misses       226811   226642   -169     
  Partials       1576     1576            
Impacted Files Coverage Δ
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% <ø> (ø)
...apache/cloudstack/syslog/AlertsSyslogAppender.java 58.75% <0.00%> (+2.25%) :arrow_up:

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

codecov[bot] avatar Aug 11 '22 16:08 codecov[bot]

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

blueorangutan avatar Aug 15 '22 10:08 blueorangutan

Trillian test result (tid-4691) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 25698 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6619-t4691-kvm-centos7.zip Smoke tests completed. 63 look OK, 38 have errors Only failed tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestLBRuleUsage>:setup Error 3.70 test_usage.py
ContextSuite context=TestNatRuleUsage>:setup Error 5.20 test_usage.py
ContextSuite context=TestPublicIPUsage>:setup Error 6.67 test_usage.py
ContextSuite context=TestSnapshotUsage>:setup Error 8.19 test_usage.py
ContextSuite context=TestVmUsage>:setup Error 12.38 test_usage.py
ContextSuite context=TestVolumeUsage>:setup Error 13.93 test_usage.py
ContextSuite context=TestVpnUsage>:setup Error 15.52 test_usage.py
ContextSuite context=TestRouterServices>:setup Error 0.00 test_routers.py
ContextSuite context=TestAddVmToSubDomain>:setup Error 6.50 test_accounts.py
test_DeleteDomain Error 6.28 test_accounts.py
test_forceDeleteDomain Failure 6.34 test_accounts.py
test_01_user_remove_VM_running Error 0.78 test_accounts.py
test_delete_account Error 16.88 test_network.py
ContextSuite context=TestPortForwarding>:setup Error 46.58 test_network.py
test_reboot_router Error 1.70 test_network.py
test_releaseIP Error 1.56 test_network.py
ContextSuite context=TestRouterRules>:setup Error 3.10 test_network.py
test_DeployVmAffinityGroup Error 0.03 test_affinity_groups.py
test_DeployVmAntiAffinityGroup Error 0.02 test_affinity_groups.py
ContextSuite context=TestListIdsParams>:setup Error 0.00 test_list_ids_parameter.py
ContextSuite context=TestCpuCapServiceOfferings>:setup Error 0.00 test_service_offerings.py
ContextSuite context=TestServiceOfferings>:setup Error 1.58 test_service_offerings.py
test_DeployVmAntiAffinityGroup_in_project Error 0.03 test_affinity_groups_projects.py
ContextSuite context=TestRemoteDiagnostics>:setup Error 0.00 test_diagnostics.py
ContextSuite context=TestSnapshotRootDisk>:setup Error 0.00 test_snapshots.py
ContextSuite context=TestAnnotations>:setup Error 0.00 test_annotations.py
test_query_async_job_result Error 2.52 test_async_job.py
ContextSuite context=TestLoadBalance>:setup Error 0.00 test_loadbalance.py
ContextSuite context=TestMultipleVolumeAttach>:setup Error 0.00 test_attach_multiple_volumes.py
test_list_vms_metrics Error 0.03 test_metrics_api.py
test_01_positive_tests_usage Failure 2.46 test_usage_events.py
ContextSuite context=TestDeployVirtioSCSIVM>:setup Error 0.00 test_deploy_virtio_scsi_vm.py
test_nic_secondaryip_add_remove Error 16.66 test_multipleips_per_nic.py
test_01_deploy_vm_with_extraconfig_throws_exception_kvm Error 1.18 test_deploy_vm_extra_config_data.py
test_02_deploy_vm_with_extraconfig_kvm Error 0.14 test_deploy_vm_extra_config_data.py
test_03_update_vm_with_extraconfig_kvm Error 1.15 test_deploy_vm_extra_config_data.py
test_01_primary_storage_nfs Error 0.10 test_primary_storage.py
ContextSuite context=TestStorageTags>:setup Error 0.20 test_primary_storage.py
test_deploy_vm_from_iso Error 7.55 test_deploy_vm_iso.py
test_00_deploy_vm_root_resize Error 0.05 test_deploy_vm_root_resize.py
test_01_deploy_vm_root_resize Failure 0.03 test_deploy_vm_root_resize.py
test_02_deploy_vm_root_resize Failure 0.02 test_deploy_vm_root_resize.py
test_deployvm_userdata Error 0.06 test_deploy_vm_with_userdata.py
test_deployvm_userdata_post Error 0.05 test_deploy_vm_with_userdata.py
test_deployvm_firstfit Error 0.06 test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userconcentrated Error 0.06 test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userdispersing Error 0.06 test_deploy_vms_with_varied_deploymentplanners.py
test_03_deploy_vm_domain_service_offering Error 5.04 test_domain_service_offerings.py
test_03_deploy_and_scale_kubernetes_cluster Failure 22.72 test_kubernetes_clusters.py
test_07_deploy_kubernetes_ha_cluster Failure 0.04 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 0.04 test_kubernetes_clusters.py
test_09_delete_kubernetes_ha_cluster Failure 0.03 test_kubernetes_clusters.py
test_01_events_resource Error 287.66 test_events_resource.py
test_01_events_resource Error 287.67 test_events_resource.py
test_01_so_removal_resource_update Error 0.15 test_resource_accounting.py
test_01_deploy_vm_on_specific_host Error 1.16 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 1.15 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 1.15 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 1.17 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 0.13 test_vm_deployment_planner.py
ContextSuite context=TestResetVmOnReboot>:setup Error 0.00 test_reset_vm_on_reboot.py
test_04_deploy_vm_for_other_user_and_test_vm_operations Failure 85.18 test_network_permissions.py
ContextSuite context=TestNetworkPermissions>:teardown Error 1.32 test_network_permissions.py
ContextSuite context=TestDeployVM>:setup Error 0.00 test_vm_life_cycle.py
ContextSuite context=TestVMLifeCycle>:setup Error 1.59 test_vm_life_cycle.py
test_02_deploy_vm_from_direct_download_template Error 0.03 test_templates.py
ContextSuite context=TestTemplates>:setup Error 7.48 test_templates.py
test_09_project_suspend Error 0.10 test_projects.py
test_10_project_activation Error 1.09 test_projects.py
test_02_routervm_iptables_policies Error 0.03 test_routers_iptables_default_policy.py
ContextSuite context=TestVmSnapshot>:setup Error 1.56 test_vm_snapshots.py
ContextSuite context=TestCreateVolume>:setup Error 0.00 test_volumes.py
ContextSuite context=TestVolumes>:setup Error 0.00 test_volumes.py
test_hostha_enable_ha_when_host_in_maintenance Error 302.83 test_hostha_kvm.py

blueorangutan avatar Aug 15 '22 17:08 blueorangutan

to many gremlins

DaanHoogland avatar Aug 16 '22 12:08 DaanHoogland