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

Commit

Permalink
rootless: Disable vhost-net for rootless
Browse files Browse the repository at this point in the history
Since the /dev/vhost-net device is owned by root, we cannot used
vhost-net networking in rootless mode. Instead of having to
do this manually in the toml, disable vhost-net when the runtime
detects it is running rootless.

Fixes #2321

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde committed Dec 5, 2019
1 parent 00ff99b commit 0babd38
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion virtcontainers/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/vishvananda/netns"
"golang.org/x/sys/unix"

"github.com/kata-containers/runtime/pkg/rootless"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/utils"
Expand Down Expand Up @@ -410,7 +411,12 @@ func xConnectVMNetwork(endpoint Endpoint, h hypervisor) error {
queues = int(h.hypervisorConfig().NumVCPUs)
}

disableVhostNet := h.hypervisorConfig().DisableVhostNet
var disableVhostNet bool
if rootless.IsRootless() {
disableVhostNet = true
} else {
disableVhostNet = h.hypervisorConfig().DisableVhostNet
}

if netPair.NetInterworkingModel == NetXConnectDefaultModel {
netPair.NetInterworkingModel = DefaultNetInterworkingModel
Expand Down

0 comments on commit 0babd38

Please sign in to comment.