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
|
||||
}
|
||||
|
||||
// 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.
|
||||
sharedVolume := Volume{
|
||||
MountTag: mountGuest9pTag,
|
||||
@ -615,23 +622,29 @@ func (k *kataAgent) startSandbox(sandbox *Sandbox) error {
|
||||
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
|
||||
// in the guest.
|
||||
// This is where at least some of the host config files
|
||||
// (resolv.conf, etc...) and potentially all container
|
||||
// rootfs will reside.
|
||||
sharedVolume := &grpc.Storage{
|
||||
Driver: kata9pDevType,
|
||||
Source: mountGuest9pTag,
|
||||
MountPoint: kataGuestSharedDir,
|
||||
Fstype: type9pFs,
|
||||
Options: sharedDir9pOptions,
|
||||
// append 9p shared volume to storages only if filesystem sharing is supported
|
||||
if caps.isFsSharingSupported() {
|
||||
sharedDir9pOptions = append(sharedDir9pOptions, fmt.Sprintf("msize=%d", sandbox.config.HypervisorConfig.Msize9p))
|
||||
|
||||
// We mount the shared directory in a predefined location
|
||||
// in the guest.
|
||||
// This is where at least some of the host config files
|
||||
// (resolv.conf, etc...) and potentially all container
|
||||
// rootfs will reside.
|
||||
sharedVolume := &grpc.Storage{
|
||||
Driver: kata9pDevType,
|
||||
Source: mountGuest9pTag,
|
||||
MountPoint: kataGuestSharedDir,
|
||||
Fstype: type9pFs,
|
||||
Options: sharedDir9pOptions,
|
||||
}
|
||||
|
||||
storages = append(storages, sharedVolume)
|
||||
}
|
||||
|
||||
storages := []*grpc.Storage{sharedVolume}
|
||||
|
||||
if sandbox.shmSize > 0 {
|
||||
path := filepath.Join(kataGuestSandboxDir, shmDir)
|
||||
shmSizeOption := fmt.Sprintf("size=%d", sandbox.shmSize)
|
||||
|
Loading…
Reference in New Issue
Block a user