-
Notifications
You must be signed in to change notification settings - Fork 669
[WIP]: Create a Plugin System for Lima #3573
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
Draft
unsuman
wants to merge
34
commits into
lima-vm:master
Choose a base branch
from
unsuman:feature/driver-plugin-system
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
68726ee
driver(internal): use existing driver.Driver as plugin interface
unsuman ff8a943
driver(internal): registry init
unsuman 0f4bf50
refactor(BaseDriver): remove driver.BaseDriver from Lima level
unsuman c01a36d
refactor(BaseDriver): remove driver.BaseDriver from driver(qemu) level
unsuman a1f79d5
refactor(BaseDriver): remove driver.BaseDriver from driver(vz) level
unsuman bff7bdc
refactor(BaseDriver): remove driver.BaseDriver from driver(wsl2) level
unsuman 7fbd83a
refactor(BaseDriver): make drivers implement the driver.Driver interface
unsuman 0fa3176
driver(internal): divide the driver.Driver interface and define some …
unsuman 70372ca
driver(internal): change lima to support internal drivers
unsuman 4c16e49
driver(internal): add blank imports and make changes to Lima for inte…
unsuman f79456a
driver(internal): add register files and make drivers compatible for …
unsuman 54f1866
driver(internal): list available built-in drivers
unsuman f020bd5
driver(internal): fix CI checks and lint errors
unsuman 0f42995
refactor(driver): move qemu,vz and wsl2 to pkg/driver
unsuman 38dcc7e
driver(internal): refactor Snapshot to SnapshotManager in driver inte…
unsuman 4630452
driver(internal): compile vz on darwin, wsl2 on windows only and impl…
unsuman dac2cff
refactor(driver): remove redundant builtins pkg
unsuman 9db1cf4
driver(external): proto file init
unsuman 76e73f9
driver(external): external driver manager init
unsuman b8558d0
driver(external): complete proto file for driver interface
unsuman b91f166
driver(external): finalise proto file and generate gRPC code
unsuman 6c1a5cf
driver(external): implement server defination
unsuman 28ce50c
driver(external): implement the grpc client and server
unsuman d7ccaf8
driver(external): remove error from the grpc response payload
unsuman ed4ecef
driver(external): add discovery of external drivers
unsuman 80bf1d9
driver(internal): consolidate some functions to single GetInfo() func…
unsuman 13db654
driver(external): consolidate some functions to single GetInfo() rpc …
unsuman 6351822
driver(external): implement Start() & SetConfig() as server methods
unsuman ffa8b16
driver(external): complete client grpc implementation and one server …
unsuman 09e50ef
driver(external): tweak some external driver manager code
unsuman 35d47d6
driver(external): complete external driver manager and registering pr…
unsuman fad8a71
driver(external): some tweaks around server and client code
unsuman 2a82bf3
driver(external): server logs to a file and fixed json marshal error …
unsuman 1dc43c4
driver(external): implement bidirectional streaming for GuestAgentConn()
unsuman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build darwin && !no_vz | ||
|
||
// SPDX-FileCopyrightText: Copyright The Lima Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package main | ||
|
||
// Import vz driver to register it in the registry on darwin. | ||
import _ "github.com/lima-vm/lima/pkg/driver/vz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build windows && !no_wsl | ||
|
||
// SPDX-FileCopyrightText: Copyright The Lima Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package main | ||
|
||
// Import wsl2 driver to register it in the registry on windows. | ||
import _ "github.com/lima-vm/lima/pkg/driver/wsl2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// SPDX-FileCopyrightText: Copyright The Lima Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package client | ||
|
||
import ( | ||
"context" | ||
"io" | ||
"math" | ||
"net" | ||
"time" | ||
|
||
pb "github.com/lima-vm/lima/pkg/driver/external" | ||
"github.com/sirupsen/logrus" | ||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/credentials/insecure" | ||
"google.golang.org/grpc/keepalive" | ||
) | ||
|
||
type DriverClient struct { | ||
Stdin io.WriteCloser | ||
Stdout io.ReadCloser | ||
Conn *grpc.ClientConn | ||
DriverSvc pb.DriverClient | ||
logger *logrus.Logger | ||
} | ||
|
||
func NewDriverClient(stdin io.WriteCloser, stdout io.ReadCloser, logger *logrus.Logger) (*DriverClient, error) { | ||
pipeConn := newPipeConn(stdin, stdout) | ||
opts := []grpc.DialOption{ | ||
grpc.WithDefaultCallOptions( | ||
grpc.MaxCallRecvMsgSize(math.MaxInt64), | ||
grpc.MaxCallSendMsgSize(math.MaxInt64), | ||
), | ||
grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) { | ||
return pipeConn, nil | ||
}), | ||
grpc.WithTransportCredentials(insecure.NewCredentials()), | ||
grpc.WithKeepaliveParams(keepalive.ClientParameters{ | ||
Time: 10 * time.Second, | ||
Timeout: 20 * time.Second, | ||
PermitWithoutStream: true, | ||
}), | ||
} | ||
|
||
// conn, err := grpc.NewClient("pipe", opts...) | ||
// if err != nil { | ||
// logger.Errorf("failed to create gRPC driver client connection: %v", err) | ||
// return nil, err | ||
// } | ||
|
||
conn, err := grpc.Dial("pipe", opts...) | ||
if err != nil { | ||
logger.Errorf("failed to dial gRPC driver client connection: %v", err) | ||
return nil, err | ||
} | ||
|
||
driverSvc := pb.NewDriverClient(conn) | ||
|
||
return &DriverClient{ | ||
Stdin: stdin, | ||
Stdout: stdout, | ||
Conn: conn, | ||
DriverSvc: driverSvc, | ||
logger: logger, | ||
}, nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually this should follow:
interface
forqemuimgutil
andnativeimgutil
#3518Not an urgent topic though