mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 08:47:56 +00:00
rootless: Disable vhost-net for rootless
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>
This commit is contained in:
parent
00ff99bcb6
commit
0babd38de0
@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/vishvananda/netns"
|
"github.com/vishvananda/netns"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
|
"github.com/kata-containers/runtime/pkg/rootless"
|
||||||
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/utils"
|
"github.com/kata-containers/runtime/virtcontainers/utils"
|
||||||
@ -410,7 +411,12 @@ func xConnectVMNetwork(endpoint Endpoint, h hypervisor) error {
|
|||||||
queues = int(h.hypervisorConfig().NumVCPUs)
|
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 {
|
if netPair.NetInterworkingModel == NetXConnectDefaultModel {
|
||||||
netPair.NetInterworkingModel = DefaultNetInterworkingModel
|
netPair.NetInterworkingModel = DefaultNetInterworkingModel
|
||||||
|
Loading…
Reference in New Issue
Block a user