apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2k stars 1.09k forks source link

plugins/shutdown: fix triggerShutdown scheduling and response #9276

Closed shwstppr closed 3 months ago

shwstppr commented 3 months ago

Description

Earlier the triggerShutdown API would immediately shutdown the MS and if it is the same MS on which API is called and there are no pending jobs it would lead to error in the API call. This change adds a delay to the process so the MS would be able to send response to the API.

This should fix test failure seen in PR wrt test_safe_shutdown.py, https://github.com/apache/cloudstack/pull/8601#issuecomment-2177437854https://github.com/apache/cloudstack/pull/8601#issuecomment-2177479552

Types of changes

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

Bug Severity

Screenshots (if appropriate):

How Has This Been Tested?

Without fix:

localcloud) 🐱 > trigger shutdown managementserverid=1
🙈 Error: Get "http://1.2.3.4:8080/client/api?apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=triggerShutdown&managementserverid=1&response=json&signature=7PpZ8vp4jKIbTe41HqhNwfjVp4g%3D": dial tcp 1.2.3.4:8080: connect: connection refused

After fix:

(local) 🐱 > trigger shutdown managementserverid=1
{
  "triggershutdown": {
    "managementserverid": 1,
    "pendingjobscount": 0,
    "readyforshutdown": true,
    "shutdowntriggered": true
  }
}

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

DaanHoogland commented 3 months ago

@blueorangutan package

blueorangutan commented 3 months ago

@DaanHoogland 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[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 14.95%. Comparing base (7dce3d8) to head (bd2c496). Report is 1 commits behind head on 4.19.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## 4.19 #9276 +/- ## ============================================ - Coverage 14.95% 14.95% -0.01% + Complexity 11013 11006 -7 ============================================ Files 5382 5382 Lines 470092 470095 +3 Branches 57685 59626 +1941 ============================================ - Hits 70311 70281 -30 - Misses 391993 392031 +38 + Partials 7788 7783 -5 ``` | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/9276/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/9276/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.28% <ø> (ø)` | | | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/9276/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `15.66% <100.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.

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

blueorangutan commented 3 months ago

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

sureshanaparti commented 3 months ago

@blueorangutan test

blueorangutan commented 3 months ago

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

blueorangutan commented 3 months ago

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

Test Result Time (s) Test File
sureshanaparti commented 3 months ago

No issues with safe shutdown test, merging based on review / test result.