Skip to content

Action to shutdown all servers in hypervisor#445

Draft
jose-caballero wants to merge 4 commits into
mainfrom
action_to_shutdown_all_servers_in_hypervisor
Draft

Action to shutdown all servers in hypervisor#445
jose-caballero wants to merge 4 commits into
mainfrom
action_to_shutdown_all_servers_in_hypervisor

Conversation

@jose-caballero
Copy link
Copy Markdown
Contributor

Description:

Special Notes:


Submitter:

Have you (where applicable):

  • Added unit tests?
  • Checked the latest commit runs on Dev?
  • Updated the example config file(s) and README?

Reviewer

Does this PR:

  • Place non-StackStorm code into the lib directory?
  • Have unit tests for the action/sensor and lib layers?
  • Have clear and obvious action parameter names and descriptions?

The function should first find the entire list of servers on that
hypervisor, using the openstack query library.
Then, calls the api function to shut down a list of servers,
passing the list of Server IDs.

Note on the implementation:
* due to the current implementation of function run() in
  actions/src/openstack_actions.py, any function in workflows/ directory
  can accept as input argument either an openstack.Connection() object or
  a cloud_account name, but not both.
  In this case, we need both: the cloud_account name for the query function
  to find the servers and the connection object for the function to shut them down.
  We extract the cloud_account value from the connection object.
@jose-caballero jose-caballero marked this pull request as draft May 26, 2026 08:49
@jose-caballero jose-caballero force-pushed the action_to_shutdown_all_servers_in_hypervisor branch 11 times, most recently from d5ae81d to 68a7f25 Compare May 28, 2026 12:55
Add the functions to shut off a single server and a list of servers.
They are used by the new Action to shutdown all servers on a hypervisor.

An Exception is raised when a server goes to ERROR status instead.
@jose-caballero jose-caballero force-pushed the action_to_shutdown_all_servers_in_hypervisor branch from 68a7f25 to 9c169d7 Compare May 28, 2026 13:01
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 78.72340% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.33%. Comparing base (c94154f) to head (9c169d7).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
lib/apis/openstack_api/openstack_server.py 65.00% 6 Missing and 1 partial ⚠️
lib/workflows/hv_shutdown_servers.py 88.88% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #445      +/-   ##
==========================================
- Coverage   99.69%   99.33%   -0.37%     
==========================================
  Files         109      110       +1     
  Lines        2648     2694      +46     
  Branches      332      338       +6     
==========================================
+ Hits         2640     2676      +36     
- Misses          7       15       +8     
- Partials        1        3       +2     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant