-
Notifications
You must be signed in to change notification settings - Fork 114
channel: Check for channel type in kernel cmdline options #508
Conversation
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.
LGTM. Thanks @amshinde for implementing the proper solution with the fallback. And by having the fallback, you're solving the current issue without having to wait for the runtime PR to land 👍
serialCh commType = iota | ||
|
||
// vsock channel | ||
vsockCh |
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.
Because there's a new line and comments between serialCh
and vsockCh
, and unknownCh
, I think both vsockCh
and unknownCh
are going to be typed as int
instead of commType
.
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.
@sboeuf I was able to assign between those values, I think compile would have complained in that case.
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.
You can still compile since it's a cast later in the code, but unless the Go compiler got smarter, this was a problem I had encountered before.
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.
No golang will never cast automatically.
Looks like newline are allowed according to this wiki: https://github.com/golang/go/wiki/Iota
8c777c9
to
2e3db7f
Compare
/test |
channel.go
Outdated
defer span.Finish() | ||
|
||
// check vsock path | ||
var err error |
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.
useless variable, please use
if _, err := os.Stat(vSockDevPath); err != 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.
@devimc Fixed.
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.
Nice. Could you add a TestParseCmdlineOption*()
test for the new kernel option though?
2e3db7f
to
6a32b7b
Compare
/test |
channel.go
Outdated
@@ -228,23 +268,51 @@ func (c *serialChannel) teardown() error { | |||
return c.serialConn.Close() | |||
} | |||
|
|||
// isAFVSockSupported checks if vsock channel is used by the runtime | |||
// by checking for devices under the vhost-vsock driver path. | |||
// It returns true if more a device is found for the driver. |
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.
nit: can you clarify this last sentence?
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.
done
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.
aside from small nit LGTM
With a recent kernel change, the agent can no longer rely on /dev/vsock and AF_VSOCK in socket(), to detect if vhost-vsock channel has been passed by the runtime. These are not created when the vhost-vsock driver is initialised. The runtime should now pass this information explicilty. Based on the channel type passed, the agent now checks for that partcular channel type. In case it is not passed, check for both serial and vsock channel. This also introduces a change in the way vsock channel is detected by checking for devices under the vhost-vsock driver path. Fixes kata-containers#506 Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
6a32b7b
to
2af3599
Compare
/test |
With a recent kernel change, the agent can no longer rely on
/dev/vsock and AF_VSOCK in socket(), to detect if vhost-vsock
channel has been passed by the runtime.
These are not created when the vhost-vsock driver is initialised.
The runtime should now pass this information explicilty.
Based on the channel type passed, the agent now checks for that
partcular channel type.
In case it is not passed, check for both serial and vsock channel.
This also introduces a change in the way vsock channel is detected
by checking for devices under the vhost-vsock driver path.
Fixes #506
Signed-off-by: Archana Shinde archana.m.shinde@intel.com