cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Support ApiServer to enforce POST requests for state changing APIs and requests with timestamps

Open sureshanaparti opened this issue 9 months ago • 39 comments

Description

This PR enables ApiServer to support enforcing POST requests with timestamps for state changing APIs, thought the setting 'enforce.post.requests.and.timestamps' (default: false).

Other related sub-project PRs supporting POST requests:

  • https://github.com/apache/cloudstack-cloudmonkey/pull/161
  • https://github.com/apache/cloudstack-csbench/pull/18
  • https://github.com/apache/cloudstack-go/pull/107

Need to update the cloudstack-go sdk version in the below sub-projects once the changes in https://github.com/apache/cloudstack-go/pull/107 are merged and the sdk is released.

  • K8S Provider: https://github.com/apache/cloudstack-kubernetes-provider/blob/a315d9e1c2aa3d571abf2ef992c230d5cbcf58c6/go.mod#L6
  • Terraform Provider: https://github.com/apache/cloudstack-terraform-provider/blob/d85ccb23d232b52e5e1d0d535b1c51ca041f178d/go.mod#L4
  • CAPC: https://github.com/kubernetes-sigs/cluster-api-provider-cloudstack/blob/4ba60650a17ae795d789e562d1895f6cc3b2cb89/go.mod#L8

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)
  • [x] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
  • [ ] build/CI
  • [ ] test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [x] Major
  • [ ] Minor

Bug Severity

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

Screenshots (if appropriate):

How Has This Been Tested?

Tested some VM, Volume operations with setting 'enforce.post.requests.and.timestamps' false and true.

How did you try to break this feature and the system with this change?

sureshanaparti avatar May 21 '25 12:05 sureshanaparti

@blueorangutan package

sureshanaparti avatar May 21 '25 12:05 sureshanaparti

@sureshanaparti 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 avatar May 21 '25 12:05 blueorangutan

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

blueorangutan avatar May 21 '25 13:05 blueorangutan

@blueorangutan test

sureshanaparti avatar May 21 '25 16:05 sureshanaparti

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

blueorangutan avatar May 21 '25 16:05 blueorangutan

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

Test Result Time (s) Test File

blueorangutan avatar May 22 '25 08:05 blueorangutan

@blueorangutan package

sureshanaparti avatar May 23 '25 06:05 sureshanaparti

@sureshanaparti 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 avatar May 23 '25 06:05 blueorangutan

Codecov Report

:x: Patch coverage is 11.11111% with 64 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 16.58%. Comparing base (3e3a0c0) to head (a1f2604). :warning: Report is 174 commits behind head on main.

Files with missing lines Patch % Lines
server/src/main/java/com/cloud/api/ApiServlet.java 8.92% 50 Missing and 1 partial :warning:
server/src/main/java/com/cloud/api/ApiServer.java 13.33% 13 Missing :warning:
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #10899   +/-   ##
=========================================
  Coverage     16.58%   16.58%           
  Complexity    13989    13989           
=========================================
  Files          5743     5743           
  Lines        510706   510764   +58     
  Branches      62119    62124    +5     
=========================================
+ Hits          84689    84699   +10     
- Misses       416543   416591   +48     
  Partials       9474     9474           
Flag Coverage Δ
uitests 3.90% <ø> (+<0.01%) :arrow_up:
unittests 17.47% <11.11%> (-0.01%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar May 23 '25 06:05 codecov[bot]

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

blueorangutan avatar May 23 '25 07:05 blueorangutan

@blueorangutan package

sureshanaparti avatar May 23 '25 09:05 sureshanaparti

@sureshanaparti 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 avatar May 23 '25 09:05 blueorangutan

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

blueorangutan avatar May 23 '25 10:05 blueorangutan

@blueorangutan package

sureshanaparti avatar May 23 '25 15:05 sureshanaparti

@sureshanaparti 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 avatar May 23 '25 15:05 blueorangutan

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

blueorangutan avatar May 23 '25 16:05 blueorangutan

@blueorangutan test

borisstoyanov avatar May 27 '25 09:05 borisstoyanov

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

blueorangutan avatar May 27 '25 09:05 blueorangutan

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

Test Result Time (s) Test File
test_nic_secondaryip_add_remove Error 1518.90 test_multipleips_per_nic.py
ContextSuite context=TestNestedVirtualization>:setup Error 0.00 test_nested_virtualization.py
ContextSuite context=TestNetworkACL>:setup Error 0.00 test_network_acl.py
ContextSuite context=TestIpv6Network>:setup Error 0.00 test_network_ipv6.py
test_delete_account Error 1518.17 test_network.py
test_delete_network_while_vm_on_it Error 1.25 test_network.py
test_deploy_vm_l2network Error 1.23 test_network.py
test_l2network_restart Error 2.42 test_network.py
ContextSuite context=TestPortForwarding>:setup Error 3.71 test_network.py
ContextSuite context=TestPublicIP>:setup Error 13.52 test_network.py
test_reboot_router Failure 0.12 test_network.py
test_releaseIP Error 6.71 test_network.py
test_releaseIP_using_IP Error 6.82 test_network.py
ContextSuite context=TestRouterRules>:setup Error 6.93 test_network.py
ContextSuite context=TestSharedNetworkWithConfigDrive>:setup Error 1522.77 test_network.py
ContextSuite context=TestPrivateGwACL>:setup Error 0.00 test_privategw_acl.py
ContextSuite context=TestAdapterTypeForNic>:setup Error 0.00 test_nic_adapter_type.py
ContextSuite context=TestNonStrictAffinityGroups>:setup Error 0.00 test_nonstrict_affinity_group.py
ContextSuite context=TestIsolatedNetworksPasswdServer>:setup Error 0.00 test_password_server.py
ContextSuite context=TestPortForwardingRules>:setup Error 0.00 test_portforwardingrules.py
ContextSuite context=TestProjectSuspendActivate>:setup Error 1530.13 test_projects.py

blueorangutan avatar May 28 '25 10:05 blueorangutan

@blueorangutan package

sureshanaparti avatar Jun 02 '25 03:06 sureshanaparti

@sureshanaparti 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 avatar Jun 02 '25 03:06 blueorangutan

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

blueorangutan avatar Jun 02 '25 04:06 blueorangutan

@blueorangutan package

sureshanaparti avatar Jun 02 '25 12:06 sureshanaparti

@sureshanaparti 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 avatar Jun 02 '25 12:06 blueorangutan

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

blueorangutan avatar Jun 02 '25 13:06 blueorangutan

@blueorangutan package

sureshanaparti avatar Jun 02 '25 14:06 sureshanaparti

@sureshanaparti 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 avatar Jun 02 '25 14:06 blueorangutan

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

blueorangutan avatar Jun 02 '25 15:06 blueorangutan

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

github-actions[bot] avatar Jun 10 '25 10:06 github-actions[bot]

@blueorangutan package

sureshanaparti avatar Jun 11 '25 08:06 sureshanaparti