-
Notifications
You must be signed in to change notification settings - Fork 624
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
Restore guest agent unix socket functionality #2006
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,10 @@ type Driver interface { | |
|
||
ListSnapshots(_ context.Context) (string, error) | ||
|
||
// ForwardGuestAgent returns if the guest agent sock needs forwarding by host agent. | ||
ForwardGuestAgent() bool | ||
|
||
// GuestAgentConn returns the guest agent connection, or nil (if forwarded by ssh). | ||
GuestAgentConn(_ context.Context) (net.Conn, error) | ||
} | ||
|
||
|
@@ -73,6 +77,7 @@ type BaseDriver struct { | |
|
||
SSHLocalPort int | ||
VSockPort int | ||
VirtioPort string | ||
} | ||
|
||
var _ Driver = (*BaseDriver)(nil) | ||
|
@@ -137,6 +142,12 @@ func (d *BaseDriver) ListSnapshots(_ context.Context) (string, error) { | |
return "", fmt.Errorf("unimplemented") | ||
} | ||
|
||
func (d *BaseDriver) ForwardGuestAgent() bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern is still here. My point is we don't need this. Instead of treating unix sock as fallback am saying lets treat it as a way drivers can use. But drivers need to decide on the communication medium. For eg: vz will always work on vsock, virtbox will always work on unix sock (This individual drivers should decide). Hostagent should not have that code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to keep the hostagent tunneling as a fallback. It was handy when experimenting with external VMs. For the VBox driver, it can probably use a serial console. Will do a rebase of it someday, it is not important... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we say fallback i wanted this to be a universal one not just for un configured driver. Something like this 4640684. This is just a idea how we can do, based on the error we can fallback to this universal unix sock There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as it is done in the hostagent, and not copy/paste (or explicit) in the driver, that would work as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure where to cancel the forwarding process, but maybe it would just die when the instance does? |
||
// if driver is not providing, use host agent | ||
return d.VSockPort == 0 && d.VirtioPort == "" | ||
} | ||
|
||
func (d *BaseDriver) GuestAgentConn(_ context.Context) (net.Conn, error) { | ||
return nil, fmt.Errorf("unimplemented") | ||
// use the unix socket forwarded by host agent | ||
return nil, nil | ||
} |
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.
Instead of using virtioPort as a arg, can we simply do os.Stat and fallback to unix sock ?
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.
Having it as an explicit argument was a feature, but it should probably be named serialSock
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.
The communication medium is internal to us. I don't think there is a need to make it a argument. We can hardcode it like we do for unix sock just to simplify stuff
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.
If the filename is indeed fixed we can hardcode it, but then it might not even need the constant