Skip to content

Conversation

puretension
Copy link

What does this PR do?

Fixes AttributeError when Proxmox VMs don't have Qemu Agent installed or available.

Motivation

Fixes #21300 - When Qemu Agent is not installed on Proxmox VMs, the /agent/get-host-name endpoint fails and causes an AttributeError. This breaks hostname collection for VMs without the agent.

Description of the changes

  • Add AttributeError to the existing exception handling in _get_vm_hostname()
  • Falls back to using vm_name when Qemu Agent is unavailable
  • Maintains existing logging behavior for debugging

How to test the changes?

Test with Proxmox VMs that don't have Qemu Agent installed - the integration should continue working and use VM names as hostnames.

Review checklist

  • Feature or bugfix MUST have appropriate tests (existing tests cover the fallback behavior)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA
  • If you need to backport this PR to another branch, you can add the backport/ label

Copy link

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.01%. Comparing base (7b59ac0) to head (5d4b286).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

github-actions bot commented Sep 18, 2025

⚠️ The qa/skip-qa label has been added with shippable changes

The following files, which will be shipped with the agent, were modified in this PR and
the qa/skip-qa label has been added.

You can ignore this if you are sure the changes in this PR do not require QA. Otherwise, consider removing the label.

List of modified files that will be shipped with the agent
proxmox/changelog.d/21399.fixed
proxmox/datadog_checks/proxmox/check.py

@puretension puretension force-pushed the fix-proxmox-hostname-without-qemu-agent-21300 branch from 19ffa61 to 5d4b286 Compare September 18, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proxmox Integration: Cannot get hostname without Qemu Agent
1 participant