Skip to content

Improve VM guest setup and cleanup workflows#52

Merged
ericbsd merged 2 commits intomasterfrom
cleanup
Mar 1, 2026
Merged

Improve VM guest setup and cleanup workflows#52
ericbsd merged 2 commits intomasterfrom
cleanup

Conversation

@ericbsd
Copy link
Copy Markdown
Contributor

@ericbsd ericbsd commented Mar 1, 2026

  • Add explicit cleanup functions for VirtualBox, VMware, QEMU, Hyper-V, and bhyve.
  • Integrate cleanup steps for unused drivers and configurations in hypervisor detection flow.
  • Update QEMU configuration to use qxl driver instead of cirrus.
  • Enhance VMware and QEMU setup with additional service handling and device detection logic.

Summary by Sourcery

Improve virtual machine guest configuration and cleanup workflows across supported hypervisors.

New Features:

  • Add explicit cleanup routines for VirtualBox, VMware, QEMU, Hyper-V, and bhyve guests.
  • Extend hypervisor detection flow to remove unused virtual GPU drivers and stale configurations during setup.

Enhancements:

  • Update QEMU display configuration to prefer the qxl driver over cirrus for better guest graphics support.
  • Enhance VMware and QEMU guest setup with additional service management and device detection logic to better tailor configurations to the running hypervisor.

- Add explicit cleanup functions for VirtualBox, VMware, QEMU, Hyper-V, and bhyve.
- Integrate cleanup steps for unused drivers and configurations in hypervisor detection flow.
- Update QEMU configuration to use `qxl` driver instead of `cirrus`.
- Enhance VMware and QEMU setup with additional service handling and device detection logic.
@ericbsd ericbsd requested review from a team as code owners March 1, 2026 17:49
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 1, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors VM guest setup and teardown flows across multiple hypervisors by adding explicit cleanup routines, tightening hypervisor detection/driver configuration, and updating QEMU/VMware display and service handling behavior.

File-Level Changes

Change Details Files
Add explicit per-hypervisor cleanup routines and wire them into the guest lifecycle flow.
  • Introduce dedicated cleanup functions for VirtualBox, VMware, QEMU, Hyper-V, and bhyve environments.
  • Ensure cleanup functions remove/disable hypervisor-specific services, devices, and temporary configuration artifacts.
  • Integrate cleanup calls into the existing VM guest setup/teardown workflow so they are run reliably on exit or failure paths.
bin/xconfig
Tighten hypervisor detection logic and integrate cleanup and driver-selection steps.
  • Extend hypervisor detection flow to also decide which display/input drivers and supporting services should be enabled or disabled.
  • Add logic to proactively remove or ignore unused drivers/configs for non-detected hypervisors.
  • Make detection results drive which per-hypervisor cleanup/setup paths are executed.
bin/xconfig
Adjust QEMU guest graphics configuration to use the qxl driver and align related setup behavior.
  • Update QEMU X configuration template to select the qxl driver instead of cirrus for the primary display device.
  • Ensure any QEMU-specific device/service handling in setup matches the new qxl-based configuration.
  • Remove or de-emphasize cirrus-specific assumptions from the QEMU path.
cardDetect/XF86Config.qemu
bin/xconfig
Enhance VMware graphics and service handling in guest setup.
  • Refine VMware X configuration template to better match current VMware virtual GPU behavior.
  • Add or update VMware-specific device and service handling during setup (e.g., display, guest tools, or input devices).
  • Ensure VMware paths cooperate correctly with the new cleanup routines and hypervisor detection flow.
cardDetect/XF86Config.vmware
bin/xconfig

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • For the new explicit cleanup functions per hypervisor, ensure they are idempotent and invoked on all early-return/error paths in the setup flow so that partial setup does not leave stale devices or configs behind.
  • In the hypervisor detection and driver cleanup logic, double-check that the detection order and conditions won’t accidentally misclassify environments (e.g., nested or partially detected hypervisors) and remove drivers that are actually needed.
  • For the switch from cirrus to qxl in the QEMU configuration, consider adding a compatibility fallback or guard for environments where qxl is unavailable or behaves poorly, so existing guests are not broken by the change.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- For the new explicit cleanup functions per hypervisor, ensure they are idempotent and invoked on all early-return/error paths in the setup flow so that partial setup does not leave stale devices or configs behind.
- In the hypervisor detection and driver cleanup logic, double-check that the detection order and conditions won’t accidentally misclassify environments (e.g., nested or partially detected hypervisors) and remove drivers that are actually needed.
- For the switch from `cirrus` to `qxl` in the QEMU configuration, consider adding a compatibility fallback or guard for environments where `qxl` is unavailable or behaves poorly, so existing guests are not broken by the change.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericbsd ericbsd merged commit 7903ac1 into master Mar 1, 2026
1 check passed
@ericbsd ericbsd deleted the cleanup branch March 1, 2026 17:56
@github-project-automation github-project-automation bot moved this from In Review to Done in Development Tracker Mar 1, 2026
@ericbsd ericbsd self-assigned this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants