Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type Info struct {
type DriverFeatures struct {
CanRunGUI bool `json:"canRunGui,omitempty"`
DynamicSSHAddress bool `json:"dynamicSSHAddress"`
StaticSSHPort bool `json:"staticSSHPort"`
Copy link
Member

Choose a reason for hiding this comment

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

For consistency with DynamicSSHAddress, can we invert the logic and make this DynamicSSHPort ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but then it would be true by default - where we have mostly tried to keep our struct false by default

Copy link
Member Author

Choose a reason for hiding this comment

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

Since DynamicSSHAddress doesn't really do much at the moment, we could look at revising both of them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep StaticSSHPort then.

DynamicSSHAddress can be revisited in a separate issue

Copy link
Member Author

Choose a reason for hiding this comment

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

I will draft a new PR, how we can revise the API (hopefully before 2.0 is out)

Move InspectStatus to the core, and make SSHAddress and GetStatus work

SkipSocketForwarding bool `json:"skipSocketForwarding"`
NoCloudInit bool `json:"noCloudInit"`
RosettaEnabled bool `json:"rosettaEnabled"`
Expand Down
1 change: 1 addition & 0 deletions pkg/driver/wsl2/wsl_driver_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ func (l *LimaWslDriver) Info() driver.Info {

info.Features = driver.DriverFeatures{
DynamicSSHAddress: true,
StaticSSHPort: true,
SkipSocketForwarding: true,
NoCloudInit: true,
CanRunGUI: l.canRunGUI(),
Expand Down
7 changes: 6 additions & 1 deletion pkg/driverutil/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func CreateConfiguredDriver(inst *limatype.Instance, sshLocalPort int) (*driver.
return nil, fmt.Errorf("unknown or unsupported VM type: %s", *limaDriver)
}

inst.SSHLocalPort = sshLocalPort
if extDriver != nil {
extDriver.Logger.Debugf("Using external driver %q", extDriver.Name)
if extDriver.Client == nil || extDriver.Command == nil {
Expand All @@ -36,9 +35,15 @@ func CreateConfiguredDriver(inst *limatype.Instance, sshLocalPort int) (*driver.
extDriver.InstanceName = inst.Name
}

if !extDriver.Client.Info().Features.StaticSSHPort {
inst.SSHLocalPort = sshLocalPort
}
return extDriver.Client.Configure(inst), nil
}

logrus.Debugf("Using internal driver %q", intDriver.Info().Name)
if !intDriver.Info().Features.StaticSSHPort {
inst.SSHLocalPort = sshLocalPort
}
return intDriver.Configure(inst), nil
}
4 changes: 1 addition & 3 deletions pkg/hostagent/hostagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ func New(ctx context.Context, instName string, stdout io.Writer, signalCh chan o
if err != nil {
return nil, err
}
if *inst.Config.VMType == limatype.WSL2 {
sshLocalPort = inst.SSHLocalPort
}

var udpDNSLocalPort, tcpDNSLocalPort int
if *inst.Config.HostResolver.Enabled {
Expand All @@ -160,6 +157,7 @@ func New(ctx context.Context, instName string, stdout io.Writer, signalCh chan o
if err != nil {
return nil, fmt.Errorf("failed to create driver instance: %w", err)
}
sshLocalPort = inst.SSHLocalPort

vSockPort := limaDriver.Info().VsockPort
virtioPort := limaDriver.Info().VirtioPort
Expand Down