Disable VHost when host does not support vhost-net#422
Disable VHost when host does not support vhost-net#422jiulongzaitian wants to merge 1 commit intokata-containers:masterfrom
Conversation
|
PSS Measurement: Memory inside container: |
|
PSS Measurement: Memory inside container: |
| /virtcontainers/shim/mock/kata-shim/kata-shim | ||
| /virtcontainers/utils/supportfiles | ||
| /virtcontainers/profile.cov | ||
| .idea/ |
There was a problem hiding this comment.
This should go in its own separate commit.
There was a problem hiding this comment.
Yes please make sure we don't introduce this into the PR.
egernst
left a comment
There was a problem hiding this comment.
Is it possible to add some test coverage for this? May need to create a namespace to work in for testing (so not to muck with the host's sysfs?)
| func haveVhostNetKernelModule() bool { | ||
| // First, check to see if the vhost module is already loaded | ||
| if fileExists("/sys/module/vhost_net") { | ||
| return true |
There was a problem hiding this comment.
maybe we don't need func fileExsits here since it's really simple : just a Stat and if we really need this func , it should be a utils not just for network itself.
Codecov Report
@@ Coverage Diff @@
## master #422 +/- ##
=========================================
Coverage ? 63.76%
=========================================
Files ? 87
Lines ? 8831
Branches ? 0
=========================================
Hits ? 5631
Misses ? 2594
Partials ? 606
Continue to review full report at Codecov.
|
|
PSS Measurement: Memory inside container: |
virtcontainers/network.go
Outdated
| // (either loaded or available to be loaded) | ||
| func haveVhostNetKernelModule() bool { | ||
| // First, check to see if the vhost module is already loaded | ||
| if _, err := os.Stat("/sys/module/vhost_net"); !os.IsNotExist(err) { |
There was a problem hiding this comment.
This isn't right, I think if Stat() returns error, no matter what the error is, it should return false
There was a problem hiding this comment.
if _, err := os.Stat(vhostNetKernelModulePath); err != nil {
return false
}
Fixes: kata-containers#169 Signed-off-by: zhangjie <iamkadisi@163.com>
| // First, check to see if the vhost module is already loaded | ||
| if _, err := os.Stat(vhostNetKernelModulePath); !os.IsNotExist(err) { | ||
| return true | ||
| } |
There was a problem hiding this comment.
This isn't right, I think if Stat() returns error, no matter what the error is, it should return false
There was a problem hiding this comment.
Further, we have code to do this already in the runtime itself:
You could potentially move that code into virtcontainers (maybe into virtcontainers/utils/utils.go) and then make the runtime:
import vcu "github.com/kata-containers/runtime/virtcontainers/utils"
vcu.haveKernelModule()
There was a problem hiding this comment.
agree @jodh-intel If we have code for it, it is better to move it to virtcontainers/utils/utils.go and reuse it in both the places.
There was a problem hiding this comment.
+1 for factorization and reusing the code with kata-check.
|
PSS Measurement: Memory inside container: |
| // First, check to see if the vhost module is already loaded | ||
| if _, err := os.Stat(vhostNetKernelModulePath); !os.IsNotExist(err) { | ||
| return true | ||
| } |
There was a problem hiding this comment.
+1 for factorization and reusing the code with kata-check.
| /virtcontainers/shim/mock/kata-shim/kata-shim | ||
| /virtcontainers/utils/supportfiles | ||
| /virtcontainers/profile.cov | ||
| .idea/ |
There was a problem hiding this comment.
Yes please make sure we don't introduce this into the PR.
|
@jiulongzaitian any progress on this ? |
|
@jiulongzaitian Any updates on this? |
|
Hi @jiulongzaitian - please could you update this PR with the feedback provided (and to resolve the merge conflict)? |
|
Maybe @jiulongzaitian is not available right now - we'll give this another week, and then decide how we push forwards with it... |
|
@jiulongzaitian Any updates? |
|
Ping @jiulongzaitian. Don't worry if you are not able to update this PR for whatever reason. But it would be useful if you could let us know if you do intend to update it, so we can decide what to do with this PR. |
|
@jiulongzaitian If you are not available, we can assign another one take over this PR. That's all right |
|
@jodh-intel @caoruidong i am very very sorry, I have been on a business trip recently. i did not pay attention on it . maybe I haven’t had time recently, you can assign another one to take over this pr. thank you |
|
Hi @jiulongzaitian - no problem. Thanks for notifying us. In which case, I think we can use the Assisted PR Process here if anyone is willing to pick up this work? We're happy to support anyone who wants to have a go :-) |
|
Note: this is similar to #497. |
|
I can pick this PR. |
|
Thanks @caoruidong! I've assigned the PR (and the issue) to you too now. |
Reuse code of kata-check. If host isn't able to load vhost_net.ko, set VHost to false and won't create vhost fds. This commit takes kata-containers#422 and addresses reviewers' comments. Fixes kata-containers#169, kata-containers#422 Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
Reuse code of kata-check. If host isn't able to load vhost_net.ko, set VHost to false and won't create vhost fds. This commit takes kata-containers#422 and addresses reviewers' comments. Fixes kata-containers#169, kata-containers#422 Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
Reuse code of kata-check. If host isn't able to load vhost_net.ko, set VHost to false and won't create vhost fds. This commit takes kata-containers#422 and addresses reviewers' comments. Fixes kata-containers#169, kata-containers#422 Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
|
@caoruidong I can see that you're working on this, please make sure you let us know when you're done reworking it, so that we can review it. |
|
Actually, closing this PR, as #706 supersedes it. |
Reuse code of kata-check. If host isn't able to load vhost_net.ko, set VHost to false and won't create vhost fds. This commit takes kata-containers#422 and addresses reviewers' comments. Fixes: kata-containers#169 Signed-off-by: zhangjie <iamkadisi@163.com> Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
So that the runtime can set guest time when needed. Fixes: kata-containers#422 Signed-off-by: Peng Tao <bergwolf@gmail.com>
Add function that creates new bridges to increase unit test coverage for virtcontainers/types/bridges. Also adds test for address formats. Fixes kata-containers#422 Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
#169
Disable VHost when host does not support vhost-net
Signed-off-by: zhangjie iamkadisi@163.com