Skip to content

Refactor: Remove driver.BaseDriver, move drivers and image-downloader to pkg/driver #3691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

unsuman
Copy link
Contributor

@unsuman unsuman commented Jul 5, 2025

This pull request introduces a significant architectural refactoring to the driver implementation in Lima. It is the foundational first part of the larger GSoC project and prepares the codebase for upcoming features by improving modularity and support for external drivers. This PR sets the project structure and refactoring needed for the next three submissions.

Key Changes

  • Removal of driver.BaseDriver: The BaseDriver struct has been removed. Interface functions are implemented directly within the specific drivers.
  • Project Restructuring: All driver-specific packages have been consolidated under pkg/driver/ directory. This co-locates driver code (e.g., pkg/qemu is now pkg/driver/qemu).
  • Image Downloader: The image downloader logic has been moved into the main Lima program to make it a shared utility.

GSoC Context

This is the 1st of 4 PRs that make up my initial GSoC project submission for mid-term evaluations. Merging this foundational PR is a prerequisite for the subsequent three, which will build upon this new architecture.

Related Issues

Copy link
Member

@alexandear alexandear left a comment

Choose a reason for hiding this comment

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

Please fix lint issues.

@unsuman unsuman force-pushed the refactor/basedriver branch 3 times, most recently from e43fdff to 3bb3e7b Compare July 7, 2025 12:38
…iver, move drivers and image-downloader to pkg/driver

Signed-off-by: Ansuman Sahoo <[email protected]>
@unsuman unsuman force-pushed the refactor/basedriver branch from 3bb3e7b to 5389e27 Compare July 7, 2025 12:47
@afbjorklund
Copy link
Member

afbjorklund commented Jul 7, 2025

Why do we still need sshLocalPort as a parameter, and not just instance? Is that for the obsolete 60022

Eventually I wanted to refactor it into host and port (and not hardcode localhost), but that's a separate topic

@alexandear alexandear self-requested a review July 7, 2025 19:58
@AkihiroSuda AkihiroSuda modified the milestones: v2.0 (?), v1.2.0 Jul 8, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks, I'm merging this.

The comment about the ssh port can be addressed separately

@AkihiroSuda AkihiroSuda merged commit d32847c into lima-vm:master Jul 8, 2025
36 checks passed
@norio-nomura
Copy link
Contributor

This PR disables kernel decompression for vz instances.
before:

if _, err := fileutils.DownloadFile(ctx, kernel, f.Kernel.File, true, "the kernel", *driver.Instance.Config.Arch); err != nil {

after:
if _, err := fileutils.DownloadFile(ctx, kernel, f.Kernel.File, false, "the kernel", *inst.Config.Arch); err != nil {

Since vz doesn’t support compressed kernels, booting with one causes the VM to fail with an internal error:

{"level":"fatal","msg":"Error Domain=VZErrorDomain Code=1 Description="Internal Virtualization error. The virtual machine failed to start." UserInfo={\n NSLocalizedFailure = "Internal Virtualization error.";\n NSLocalizedFailureReason = "The virtual machine failed to start.";\n}","time":"2025-07-09T09:48:08+09:00"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc/2025 Google Summer of Code 2025
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove BaseDriver struct Consolidate pkg/{qemu,vz,wsl2} to pkg/driver
5 participants