From c30b3a9ff1b439af295ab4296b95b41cf9f95de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 3 Mar 2022 12:22:55 +0100 Subject: [PATCH] clh: Adding a volume is not supported without SharedFS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As mounting volumes into the guest requires SharedFS setup, let's ensure we error out if trying to do so in a situation where SharedFS is not supported. Signed-off-by: Fabiano FidĂȘncio --- src/runtime/virtcontainers/clh.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 6bdc917edc..5c9c2a6413 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -958,6 +958,10 @@ func (clh *cloudHypervisor) AddDevice(ctx context.Context, devInfo interface{}, case types.HybridVSock: clh.addVSock(defaultGuestVSockCID, v.UdsPath) case types.Volume: + if !clh.supportsSharedFS() { + return fmt.Errorf("SharedFS is not supported") + } + err = clh.addVolume(v) default: clh.Logger().WithField("function", "AddDevice").Warnf("Add device of type %v is not supported.", v)