mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-01 17:52:40 +00:00
virtcontainers: Check file sharing support
If the hypervisor does not support filesystem sharing (for example, 9p), files will be copied over gRPC using the copyFile request function. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
62917621c2
commit
bc31844106
@ -255,7 +255,14 @@ func (k *kataAgent) configure(h hypervisor, id, sharePath string, builtin bool,
|
|||||||
k.proxyBuiltIn = true
|
k.proxyBuiltIn = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding the shared volume.
|
// Neither create shared directory nor add 9p device if hypervisor
|
||||||
|
// doesn't support filesystem sharing.
|
||||||
|
caps := h.capabilities()
|
||||||
|
if !caps.isFsSharingSupported() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create shared directory and add the shared volume if filesystem sharing is supported.
|
||||||
// This volume contains all bind mounted container bundles.
|
// This volume contains all bind mounted container bundles.
|
||||||
sharedVolume := Volume{
|
sharedVolume := Volume{
|
||||||
MountTag: mountGuest9pTag,
|
MountTag: mountGuest9pTag,
|
||||||
@ -615,23 +622,29 @@ func (k *kataAgent) startSandbox(sandbox *Sandbox) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedDir9pOptions = append(sharedDir9pOptions, fmt.Sprintf("msize=%d", sandbox.config.HypervisorConfig.Msize9p))
|
storages := []*grpc.Storage{}
|
||||||
|
caps := sandbox.hypervisor.capabilities()
|
||||||
|
|
||||||
// We mount the shared directory in a predefined location
|
// append 9p shared volume to storages only if filesystem sharing is supported
|
||||||
// in the guest.
|
if caps.isFsSharingSupported() {
|
||||||
// This is where at least some of the host config files
|
sharedDir9pOptions = append(sharedDir9pOptions, fmt.Sprintf("msize=%d", sandbox.config.HypervisorConfig.Msize9p))
|
||||||
// (resolv.conf, etc...) and potentially all container
|
|
||||||
// rootfs will reside.
|
// We mount the shared directory in a predefined location
|
||||||
sharedVolume := &grpc.Storage{
|
// in the guest.
|
||||||
Driver: kata9pDevType,
|
// This is where at least some of the host config files
|
||||||
Source: mountGuest9pTag,
|
// (resolv.conf, etc...) and potentially all container
|
||||||
MountPoint: kataGuestSharedDir,
|
// rootfs will reside.
|
||||||
Fstype: type9pFs,
|
sharedVolume := &grpc.Storage{
|
||||||
Options: sharedDir9pOptions,
|
Driver: kata9pDevType,
|
||||||
|
Source: mountGuest9pTag,
|
||||||
|
MountPoint: kataGuestSharedDir,
|
||||||
|
Fstype: type9pFs,
|
||||||
|
Options: sharedDir9pOptions,
|
||||||
|
}
|
||||||
|
|
||||||
|
storages = append(storages, sharedVolume)
|
||||||
}
|
}
|
||||||
|
|
||||||
storages := []*grpc.Storage{sharedVolume}
|
|
||||||
|
|
||||||
if sandbox.shmSize > 0 {
|
if sandbox.shmSize > 0 {
|
||||||
path := filepath.Join(kataGuestSandboxDir, shmDir)
|
path := filepath.Join(kataGuestSandboxDir, shmDir)
|
||||||
shmSizeOption := fmt.Sprintf("size=%d", sandbox.shmSize)
|
shmSizeOption := fmt.Sprintf("size=%d", sandbox.shmSize)
|
||||||
|
Loading…
Reference in New Issue
Block a user