Fix: Add timeout to handle openstack stack cost 89/73689/2
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 8 Oct 2025 00:32:51 +0000 (10:32 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 8 Oct 2025 10:40:52 +0000 (20:40 +1000)
commitb09fec03b7c7f96944b3c5feddf92be2da357e03
treedfaf824f11b434bbf9d18d4a5a9dc9dc6360715f
parent8657cf88745f9379c183575be9382badf1d594b9
Fix: Add timeout to handle openstack stack cost

The openstack stack cost command was hanging indefinitely when
retrieving stack costs, causing Jenkins jobs to get stuck at
'INFO: Retrieving stack cost for: <stack-name>'. This led to:

- Jobs stuck waiting for cost retrieval to complete
- Subsequent jobs blocked on checkpoints
- Jenkins capacity issues with queue buildup
- Manual intervention required to cancel stuck jobs

This change adds comprehensive timeout handling to prevent these
hangs:

- Add timeout parameter to cost() function (default: 60 seconds)
- Add timeout to urllib.request.urlopen() network calls
- Wrap network operations in try/except to catch timeouts and errors
- Return 0 cost on timeout instead of hanging (graceful degradation)
- Add --timeout CLI option for user configuration
- Add proper warning/error logging for debugging

The command now completes within the timeout period and allows jobs
to continue even if cost retrieval fails, preventing the recurring
issue of Jenkins job hangs.

Issue: Jobs hanging at stack cost retrieval phase
Affected jobs: daexim-csit, openflowplugin-csit, ovsdb-csit

Change-Id: I645a17f3f2ba430e15b159584984e51ca0454ca8
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
lftools/openstack/cmd.py
lftools/openstack/stack.py
releasenotes/notes/fix-openstack-stack-cost-timeout-6f4f66a5cd97594d.yaml [new file with mode: 0644]