Skip to content

Commit d79a403

Browse files
committed
rename AgentConnectionError -> AgentVsockDialError
1 parent a021f6c commit d79a403

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

lib/guest/client.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ const (
2828
vsockGuestPort = 2222
2929
)
3030

31-
// AgentConnectionError indicates the guest agent is not responding.
32-
// This can happen if:
33-
// - The VM is still booting
34-
// - The guest agent was stopped or deleted
35-
type AgentConnectionError struct {
31+
// AgentVSockDialError indicates the vsock dial to the guest agent failed.
32+
// This typically means the VM is still booting or the agent hasn't started yet.
33+
type AgentVSockDialError struct {
3634
Err error
3735
}
3836

39-
func (e *AgentConnectionError) Error() string {
40-
return fmt.Sprintf("guest agent not responding (it may have been stopped, deleted, or the VM is still booting): %v", e.Err)
37+
func (e *AgentVSockDialError) Error() string {
38+
return fmt.Sprintf("vsock dial failed (VM may still be booting): %v", e.Err)
4139
}
4240

43-
func (e *AgentConnectionError) Unwrap() error {
41+
func (e *AgentVSockDialError) Unwrap() error {
4442
return e.Err
4543
}
4644

@@ -80,7 +78,7 @@ func GetOrCreateConn(ctx context.Context, dialer hypervisor.VsockDialer) (*grpc.
8078
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
8179
netConn, err := dialer.DialVsock(ctx, vsockGuestPort)
8280
if err != nil {
83-
return nil, &AgentConnectionError{Err: err}
81+
return nil, &AgentVSockDialError{Err: err}
8482
}
8583
return netConn, nil
8684
}),
@@ -168,9 +166,9 @@ func ExecIntoInstance(ctx context.Context, dialer hypervisor.VsockDialer, opts E
168166
// isRetryableConnectionError returns true if the error indicates the guest agent
169167
// is not yet ready and we should retry connecting.
170168
func isRetryableConnectionError(err error) bool {
171-
// Check for our custom AgentConnectionError
172-
var connErr *AgentConnectionError
173-
if errors.As(err, &connErr) {
169+
// Check for vsock dial errors
170+
var dialErr *AgentVSockDialError
171+
if errors.As(err, &dialErr) {
174172
return true
175173
}
176174

0 commit comments

Comments
 (0)