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 <[email protected]>
  • Loading branch information
amshinde committed Dec 6, 2019
1 parent 2414edd commit 3d5e0db
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 @@ -24,6 +24,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 @@ -440,7 +441,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 3d5e0db

Please sign in to comment.