Skip to content

Conversation

@norio-nomura
Copy link
Contributor

Changed LimaVzDriver.Start() to return as soon as possible.

There is a process that I want to put before calling LimaVzDriver.SSHAddress() after LimaVzDriver.Start() is returned.

…Driver.SSHAddress()` instead of `startVM`

Changed `LimaVzDriver.Start()` to return as soon as possible.

There is a process that I want to put before calling `LimaVzDriver.SSHAddress()` after `LimaVzDriver.Start()` is returned.

Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
@afbjorklund
Copy link
Member

afbjorklund commented Oct 24, 2025

I'm pretty sure that the SSHAddress never does anything, it is currently implemented in InspectStatus instead

Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
@norio-nomura
Copy link
Contributor Author

I'm pretty sure that the SSHAddress never does anything, it is currently implemented in InspectStatus instead

Why?

@norio-nomura
Copy link
Contributor Author

There is a process that I want to put before calling LimaVzDriver.SSHAddress() after LimaVzDriver.Start() is returned.

I want to put a mechanism to detect direct IP before the first ssh connection. It probably affects how the value returned by LimaVzDriver.SSHAddress() is handled.

@afbjorklund
Copy link
Member

I'm pretty sure that the SSHAddress never does anything, it is currently implemented in InspectStatus instead

Why?

It is basically a no-op.

func (l *LimaQemuDriver) SSHAddress(_ context.Context) (string, error) {
        return "127.0.0.1", nil
}
func (l *LimaVzDriver) SSHAddress(_ context.Context) (string, error) {
        return "127.0.0.1", nil
}
func (l *LimaWslDriver) SSHAddress(_ context.Context) (string, error) {
        return "127.0.0.1", nil
}

In the drivers that actually do provide an IP adress, they do that after it has been started.

And currently that logic is duplicated in the InspectStatus, but it should be moved to core...

func (l *LimaWslDriver) InspectStatus(ctx context.Context, inst *limatype.Instance) string {
        status, err := getWslStatus(ctx, inst.Name)
        if err != nil {
                inst.Status = limatype.StatusBroken
                inst.Errors = append(inst.Errors, err)
        } else {
                inst.Status = status
        }

        inst.SSHLocalPort = 22

        if inst.Status == limatype.StatusRunning {
                sshAddr, err := getSSHAddress(ctx, inst.Name)
                if err == nil {
                        inst.SSHAddress = sshAddr
                } else {
                        inst.Errors = append(inst.Errors, err)
                }
        }

        return inst.Status
}

So that "getWslStatus" is the real API call to have in the driver, and "getSSHAddress" is the real IP.

The current SSHAddress and Features.DynamicSSHAddress are more or less unused / half-done.

cc @unsuman

@norio-nomura
Copy link
Contributor Author

Thank you for your explanation. I understand. I will look for another way. This is closed.

@norio-nomura norio-nomura deleted the vz-wait-sshLocalPortAccessible-in-SSHAddress branch October 26, 2025 00:11
@norio-nomura
Copy link
Contributor Author

By the way, the interfaces defined in pkg/driver/driver.go are not documented enough.
It seems that no one but the creator knows how each is used and what kind of behavior is required.

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.

2 participants