Skip to content

Conversation

@6-dehan
Copy link
Contributor

@6-dehan 6-dehan commented Nov 24, 2025

Add a new test case gagent_install_no_device to verify that 'QEMU Guest Agent (QGA)' can be successfully installed on a VM booted without a virtio-serial device.

Changes:

  • cfg: Add gagent_install_no_device test variant and no_serial serial variant.
  • py:
  • Implement gagent_check_install_no_device using direct MSI install command.
  • Update setup to skip agent creation when serial type is none.
  • Update run_once to skip verification for install_no_device case.

ID: 4506
Signed-off-by: Dehan Meng [email protected]

Summary by CodeRabbit

  • Tests
    • Added a Windows-specific test variant for guest-agent installation without a virtio-serial device.
    • Added a corresponding no-serial variant to cover device-less scenarios.
    • Introduced dedicated test paths that bypass serial-device checks to validate installation behavior without serial support.
    • Expanded coverage for no-serial configurations across Linux and Windows.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Walkthrough

Adds a Windows-specific test variant gagent_install_no_device and a no_serial variant in the qemu test config that sets gagent_serial_type = none and check_vioser = no. In test code, guest-agent creation is skipped when gagent_serial_type is "none", and the base run_once path is bypassed when gagent_check_type equals install_no_device. New handler methods gagent_check_install_no_device are added for Linux and Windows to verify installation without a virtio-serial device.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect qemu/tests/qemu_guest_agent.py: conditional creation of QemuAgent, updated run_once sequencing, and two new gagent_check_install_no_device methods.
  • Verify qemu/tests/cfg/qemu_guest_agent.cfg: new gagent_install_no_device and no_serial variants and parameter alignment with code checks.
  • Confirm control flow covers Linux and Windows paths and that skipping agent creation has no unintended side effects.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'qemu_guest_agent: Add test for QGA install without virtio-serial' clearly and specifically describes the main change: adding a new test case for QEMU Guest Agent installation without a virtio-serial device, which aligns directly with the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@6-dehan
Copy link
Contributor Author

6-dehan commented Nov 24, 2025

@leidwang please help to review when you're free
(1/1) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.qemu_guest_agent.no_serial.gagent_install_no_device.q35: PASS (104.91 s)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
qemu/tests/qemu_guest_agent.py (2)

451-512: gagent_check_install_no_device cleanly covers the no-serial install scenario

This flow (ensure VM, open session, uninstall if present, resolve MSI path via get_qga_pkg_path when available, install using gagent_install_cmd, then assert service status) matches the intent of validating QGA install without a virtio-serial device and relies only on guest-side checks, not self.gagent. The extra get_qga_pkg_path call duplicates some work done in the Windows setup path but is harmless and keeps the test self-contained.


4681-4682: Windows setup consistently avoids gagent_create for gagent_serial_type = "none"

Mirroring the base class, this guard prevents trying to create a QemuAgent backed by a non-existent serial device in the no_serial variant, without impacting existing virtio/ISA flows. If you touch this again, a small helper like if params.get("gagent_serial_type") != "none": shared between Linux and Windows setups could reduce duplication.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5d68b3 and 4f0b173.

📒 Files selected for processing (2)
  • qemu/tests/cfg/qemu_guest_agent.cfg (2 hunks)
  • qemu/tests/qemu_guest_agent.py (4 hunks)
🔇 Additional comments (4)
qemu/tests/cfg/qemu_guest_agent.cfg (2)

669-672: New Windows gagent_install_no_device variant wiring looks correct

The combination of only Windows, only no_serial, and gagent_check_type = install_no_device cleanly targets the new Python handler without affecting existing variants.


696-699: no_serial serial variant is safely isolated to the new test

Restricting this variant to only gagent_install_no_device, setting gagent_serial_type = none, and disabling check_vioser ensures no other tests run without a GA channel and that this scenario does not expect virtio-serial.

qemu/tests/qemu_guest_agent.py (2)

430-431: Guarding gagent_create when serial type is "none"

Conditionally skipping gagent_create when gagent_serial_type is "none" avoids constructing a QemuAgent without a backing chardev, while preserving previous behaviour for all other values (including None).


4429-4431: Skipping base run_once for install_no_device avoids accessing self.gagent

By not calling QemuGuestAgentTest.run_once when gagent_check_type == "install_no_device", this path correctly avoids gagent_verify() in cases where no QemuAgent was created (the no_serial scenario), while all other check types retain the original verification.

@leidwang
Copy link
Contributor

Please add JIRA ID to the PR's description.

@leidwang
Copy link
Contributor

Does this PR need to be reviewed by Boqiao?

@6-dehan
Copy link
Contributor Author

6-dehan commented Nov 25, 2025

Does this PR need to be reviewed by Boqiao?

Yes, will add him to review and test later.

Add a new test case `gagent_install_no_device` to verify that
'QEMU Guest Agent (QGA)' can be successfully installed on a VM
booted without a virtio-serial device.

Changes:
- cfg: Add `gagent_install_no_device` test variant
  and `no_serial` serial variant.
- py:
 - Implement `gagent_check_install_no_device` using direct MSI install command.
 - Update `setup` to skip agent creation when serial type is `none`.
 - Update `run_once` to skip verification for `install_no_device` case.

Signed-off-by: Dehan Meng <[email protected]>
@6-dehan 6-dehan force-pushed the for-KVMAUTOMA-4506-install_qga_without_srl_device branch from 4f0b173 to 0f6c21b Compare December 5, 2025 03:13
@6-dehan
Copy link
Contributor Author

6-dehan commented Dec 5, 2025

@fbq815 Could you please help to review when you have a moment?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f0b173 and 0f6c21b.

📒 Files selected for processing (2)
  • qemu/tests/cfg/qemu_guest_agent.cfg (2 hunks)
  • qemu/tests/qemu_guest_agent.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • qemu/tests/cfg/qemu_guest_agent.cfg
🔇 Additional comments (3)
qemu/tests/qemu_guest_agent.py (3)

430-431: LGTM: Conditional agent creation is correctly gated.

The logic appropriately skips guest agent creation when gagent_serial_type is "none", which aligns with the test objective to verify QGA installation without a virtio-serial device.


4427-4428: LGTM: Correctly bypasses verification for no-device install test.

Skipping the base run_once (which calls gagent_verify) when gagent_check_type is "install_no_device" is appropriate, as verification requires a working virtio-serial channel that won't exist in this test scenario.


4678-4679: LGTM: Consistent with base class implementation.

The conditional agent creation pattern matches the base class implementation (Lines 430-431), ensuring consistent behavior across Windows and Linux guests.

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.

2 participants