CKS: Fix node stuck in Starting due to missing qemu-guest-agent#13715
CKS: Fix node stuck in Starting due to missing qemu-guest-agent#13715goal86sg wants to merge 2 commits into
Conversation
Backport: Add qemu-guest-agent to REQUIRED_PACKAGES in validate-cks-node script so template registration fails fast with a clear error when the package is missing (rather than letting the VM hang at Starting). Add a 120-second hard timeout with progress messages to the guest-ping loop in patch.sh. On timeout, print a clear error pointing to the missing qemu-guest-agent package. Also bound guest-sync sanity check to 30s with a clear error. Fixes apache#13471
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13715 +/- ##
============================================
- Coverage 19.65% 19.64% -0.01%
+ Complexity 19792 19790 -2
============================================
Files 6368 6368
Lines 574881 574881
Branches 70351 70351
============================================
- Hits 112970 112962 -8
- Misses 449639 449648 +9
+ Partials 12272 12271 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR backports safeguards for CloudStack Kubernetes Service (CKS) on KVM so nodes don’t hang indefinitely in Starting when the VM template lacks a functioning qemu-guest-agent. It aims to fail fast during template validation and to add bounded waiting with clearer diagnostics during the KVM guest-agent handshake.
Changes:
- Add
qemu-guest-agentto the CKS node templateREQUIRED_PACKAGESvalidation list so missing dependencies are detected early. - Add a 120s hard timeout (with periodic progress output) to the
guest-pingwait loop in the KVMpatch.shflow, and a 30s bound for theguest-syncsanity check. - Improve operator-facing error messages to point to the missing/disabled guest agent and relevant documentation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/vm/hypervisor/kvm/patch.sh | Adds bounded guest-agent wait loops with progress and clearer timeout errors to prevent indefinite hangs. |
| plugins/integrations/kubernetes-service/src/main/resources/script/validate-cks-node | Adds qemu-guest-agent to required packages for node-template validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ $((GUEST_AGENT_WAIT_TICK % 100)) -eq 0 ]; then | ||
| echo "Waiting for qemu-guest-agent to respond... (${GUEST_AGENT_WAIT_TICK}/1200 ticks, ~$((GUEST_AGENT_WAIT_TICK / 10))s elapsed)" | ||
| fi | ||
| if [ $GUEST_AGENT_WAIT_TICK -ge $GUEST_AGENT_MAX_TICKS ]; then | ||
| echo "ERROR: qemu-guest-agent not responding after 120 seconds." |
There was a problem hiding this comment.
this one makes sense to me @goal86sg . Would you apply?
| sleep 0.1 | ||
| GUEST_SYNC_TICK=$((GUEST_SYNC_TICK + 1)) | ||
| if [ $GUEST_SYNC_TICK -ge $GUEST_SYNC_MAX_TICKS ]; then | ||
| echo "ERROR: qemu-guest-agent sanity check (guest-sync) failed after 30 seconds." |
| REQUIRED_PACKAGES=(cloud-init cloud-guest-utils conntrack apt-transport-https ca-certificates curl gnupg gnupg-agent \ | ||
| software-properties-common gnupg lsb-release python3-json-pointer python3-jsonschema cloud-init containerd.io) | ||
| software-properties-common lsb-release python3-json-pointer python3-jsonschema containerd.io \ | ||
| qemu-guest-agent) | ||
| declare -a MISSING_PACKAGES | ||
| if [[ $OS == *"Ubuntu"* || $OS == *"Debian"* ]]; then |
DaanHoogland
left a comment
There was a problem hiding this comment.
code looks good, some changes can be applied
| # Fixed: Added qemu-guest-agent to REQUIRED_PACKAGES (GitHub Issue #13471) | ||
| # Also removes duplicate cloud-init and gnupg entries | ||
|
|
There was a problem hiding this comment.
I don’t think we need this comment here
There was a problem hiding this comment.
| # Fixed: Added qemu-guest-agent to REQUIRED_PACKAGES (GitHub Issue #13471) | |
| # Also removes duplicate cloud-init and gnupg entries |
|
|
||
| # Wait for the guest agent to come online | ||
| # Wait for the guest agent to come online (max 120s to avoid indefinite hang) | ||
| # FIX: Added timeout + clear error message (GitHub Issue #13471) |
There was a problem hiding this comment.
| # FIX: Added timeout + clear error message (GitHub Issue #13471) |
I think we don’t need fix comments when code is fixed.
| if [ $((GUEST_AGENT_WAIT_TICK % 100)) -eq 0 ]; then | ||
| echo "Waiting for qemu-guest-agent to respond... (${GUEST_AGENT_WAIT_TICK}/1200 ticks, ~$((GUEST_AGENT_WAIT_TICK / 10))s elapsed)" | ||
| fi | ||
| if [ $GUEST_AGENT_WAIT_TICK -ge $GUEST_AGENT_MAX_TICKS ]; then | ||
| echo "ERROR: qemu-guest-agent not responding after 120 seconds." |
There was a problem hiding this comment.
this one makes sense to me @goal86sg . Would you apply?
| sleep 0.1 | ||
| GUEST_SYNC_TICK=$((GUEST_SYNC_TICK + 1)) | ||
| if [ $GUEST_SYNC_TICK -ge $GUEST_SYNC_MAX_TICKS ]; then | ||
| echo "ERROR: qemu-guest-agent sanity check (guest-sync) failed after 30 seconds." |
| while [ "$(virsh qemu-agent-command $name '{"execute":"guest-sync","arguments":{"id":1234567890}}' 2>/dev/null)" != '{"return":1234567890}' ] | ||
| do | ||
| # Test guest agent sanity (bounded to 30s) | ||
| # FIX: Added timeout (GitHub Issue #13471) |
There was a problem hiding this comment.
worth removing this comment as well.
There was a problem hiding this comment.
| # FIX: Added timeout (GitHub Issue #13471) |
Backport: Add qemu-guest-agent to REQUIRED_PACKAGES in validate-cks-node script so template registration fails fast with a clear error when the package is missing (rather than letting the VM hang at Starting).
Add a 120-second hard timeout with progress messages to the guest-ping loop in patch.sh. On timeout, print a clear error pointing to the missing qemu-guest-agent package. Also bound guest-sync sanity check to 30s with a clear error.
Fixes #13471
Description
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?