Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Disable VHost when host does not support vhost-net#422

Closed
jiulongzaitian wants to merge 1 commit intokata-containers:masterfrom
jiulongzaitian:vhost
Closed

Disable VHost when host does not support vhost-net#422
jiulongzaitian wants to merge 1 commit intokata-containers:masterfrom
jiulongzaitian:vhost

Conversation

@jiulongzaitian
Copy link

@jiulongzaitian jiulongzaitian commented Jun 20, 2018

#169
Disable VHost when host does not support vhost-net

Signed-off-by: zhangjie iamkadisi@163.com

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 145835 KB
Proxy: 4602 KB
Shim: 8980 KB

Memory inside container:
Total Memory: 2045972 KB
Free Memory: 2007184 KB

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 148899 KB
Proxy: 4656 KB
Shim: 8875 KB

Memory inside container:
Total Memory: 2045972 KB
Free Memory: 2007184 KB

/virtcontainers/shim/mock/kata-shim/kata-shim
/virtcontainers/utils/supportfiles
/virtcontainers/profile.cov
.idea/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be included?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, it's goland IDE's trick~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in its own separate commit.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please make sure we don't introduce this into the PR.

Copy link
Member

@egernst egernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@codecov
Copy link

codecov bot commented Jun 20, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@c324b55). Click here to learn what that means.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #422   +/-   ##
=========================================
  Coverage          ?   63.76%           
=========================================
  Files             ?       87           
  Lines             ?     8831           
  Branches          ?        0           
=========================================
  Hits              ?     5631           
  Misses            ?     2594           
  Partials          ?      606
Impacted Files Coverage Δ
virtcontainers/qemu_arch_base.go 77.52% <0%> (ø)
virtcontainers/network.go 48.43% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c324b55...6dcad65. Read the comment docs.

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 144011 KB
Proxy: 4513 KB
Shim: 9092 KB

Memory inside container:
Total Memory: 2045972 KB
Free Memory: 2007308 KB

// (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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't right, I think if Stat() returns error, no matter what the error is, it should return false

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if _, err := os.Stat(vhostNetKernelModulePath); err != nil {
	return false
} 

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok ?

// First, check to see if the vhost module is already loaded
if _, err := os.Stat(vhostNetKernelModulePath); !os.IsNotExist(err) {
return true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't right, I think if Stat() returns error, no matter what the error is, it should return false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

wdyt @bergwolf, @sboeuf?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for factorization and reusing the code with kata-check.

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 146419 KB
Proxy: 4704 KB
Shim: 9001 KB

Memory inside container:
Total Memory: 2045972 KB
Free Memory: 2007572 KB

// First, check to see if the vhost module is already loaded
if _, err := os.Stat(vhostNetKernelModulePath); !os.IsNotExist(err) {
return true
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for factorization and reusing the code with kata-check.

/virtcontainers/shim/mock/kata-shim/kata-shim
/virtcontainers/utils/supportfiles
/virtcontainers/profile.cov
.idea/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please make sure we don't introduce this into the PR.

@sboeuf
Copy link

sboeuf commented Jun 27, 2018

@jiulongzaitian any progress on this ?

@amshinde
Copy link
Member

amshinde commented Jul 3, 2018

@jiulongzaitian Any updates on this?

@jodh-intel
Copy link

Hi @jiulongzaitian - please could you update this PR with the feedback provided (and to resolve the merge conflict)?

@grahamwhaley
Copy link
Contributor

Maybe @jiulongzaitian is not available right now - we'll give this another week, and then decide how we push forwards with it...

@bergwolf
Copy link
Member

@jiulongzaitian Any updates?

@jodh-intel
Copy link

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.

@caoruidong
Copy link
Member

@jiulongzaitian If you are not available, we can assign another one take over this PR. That's all right

@jiulongzaitian
Copy link
Author

@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

@jodh-intel
Copy link

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 :-)

@jodh-intel
Copy link

Note: this is similar to #497.

@caoruidong
Copy link
Member

I can pick this PR.

@jodh-intel
Copy link

Thanks @caoruidong! I've assigned the PR (and the issue) to you too now.

caoruidong added a commit to caoruidong/runtime that referenced this pull request Sep 7, 2018
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 added a commit to caoruidong/runtime that referenced this pull request Sep 7, 2018
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 added a commit to caoruidong/runtime that referenced this pull request Sep 7, 2018
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>
@sboeuf
Copy link

sboeuf commented Sep 10, 2018

@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.

@sboeuf
Copy link

sboeuf commented Sep 10, 2018

Actually, closing this PR, as #706 supersedes it.

@sboeuf sboeuf closed this Sep 10, 2018
caoruidong pushed a commit to caoruidong/runtime that referenced this pull request Sep 11, 2018
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>
zklei pushed a commit to zklei/runtime that referenced this pull request Jun 13, 2019
So that the runtime can set guest time when needed.

Fixes: kata-containers#422

Signed-off-by: Peng Tao <bergwolf@gmail.com>
lifupan pushed a commit to lifupan/kata-runtime that referenced this pull request Aug 5, 2020
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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.