Skip to content

Conversation

@norio-nomura
Copy link
Contributor

pkg/driver: Add Driver.AdditionalSetupForSSH()

AdditionalSetupForSSH provides additional setup required for SSH connection.
It is called after the VM is started, before the first SSH connection.
It returns an error if the setup fails.

pkg/driver/vz: Change waiting waitSSHLocalPortAccessible in Driver.AdditionalSetupForSSH() instead of startVM.

waitSSHLocalPortAccessible is being used for waiting configuration SSH over VSOCK.
It makes LimaVzDriver.Start() to return as soon as possible.

Replaces #4248

@norio-nomura norio-nomura force-pushed the add-dirver-additional-setup-for-ssh branch from e57439b to eafd6fe Compare October 26, 2025 07:43
@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Oct 29, 2025
AkihiroSuda
AkihiroSuda previously approved these changes Oct 29, 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, but let me merge this first:

Will need rebasing

@norio-nomura norio-nomura force-pushed the add-dirver-additional-setup-for-ssh branch from eafd6fe to fd67200 Compare October 30, 2025 00:32
## pkg/driver: Add `Driver.AdditionalSetupForSSH()`
AdditionalSetupForSSH provides additional setup required for SSH connection.
It is called after the VM is started, before the first SSH connection.
It returns an error if the setup fails.

## pkg/driver/vz: Change waiting `waitSSHLocalPortAccessible` in `Driver.AdditionalSetupForSSH()` instead of `startVM`.
`waitSSHLocalPortAccessible` is being used for waiting configuration SSH over VSOCK.
It makes `LimaVzDriver.Start()` to return as soon as possible.

Signed-off-by: Norio Nomura <[email protected]>
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

@AkihiroSuda AkihiroSuda merged commit 8c08443 into lima-vm:master Oct 30, 2025
37 checks passed
@norio-nomura norio-nomura deleted the add-dirver-additional-setup-for-ssh branch October 30, 2025 08:43
@norio-nomura
Copy link
Contributor Author

Thanks! 🙏🏻

@afbjorklund
Copy link
Member

afbjorklund commented Oct 30, 2025

This breaks the API, so we will need another beta release with this new method...

        AdditionalSetupForSSH(ctx context.Context) error

pkg/driver/ext/register.go:11:20: cannot use New() (value of type *LimaExtDriver) as driver.Driver value in argument to registry.Register: *LimaExtDriver does not implement driver.Driver (missing method AdditionalSetupForSSH)

Maybe there is also time to fix the InspectStatus and SSHAddress methods?

        // func getWslStatus(ctx context.Context, instName string) (string, error)
        InspectStatus(ctx context.Context, inst *limatype.Instance) string

        // func getSSHAddress(ctx context.Context, instName string) (string, error)
        SSHAddress(ctx context.Context) (string, error)

Instead of now, where InspectStatus has side-effects and SSHAddress is a no-op.

I will try to make a PR for it, and check it with the WSL2 (and AC and DC) drivers...

EDIT: #4270

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.

3 participants