mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-06 07:54:22 +01:00
virtiofs-nydus: add lazyload support for kata with clh
As kata with qemu has supported lazyload, so this pr aims to bring lazyload ability to kata with clh. Fixes #3654 Signed-off-by: luodaowen.backend <luodaowen.backend@bytedance.com>
This commit is contained in:
@@ -426,7 +426,7 @@ func (h hypervisor) sharedFS() (string, error) {
|
||||
supportedSharedFS := []string{config.Virtio9P, config.VirtioFS, config.VirtioFSNydus}
|
||||
|
||||
if h.SharedFS == "" {
|
||||
return config.Virtio9P, nil
|
||||
return config.VirtioFS, nil
|
||||
}
|
||||
|
||||
for _, fs := range supportedSharedFS {
|
||||
@@ -644,14 +644,9 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
return vc.HypervisorConfig{}, err
|
||||
}
|
||||
|
||||
if sharedFS == config.VirtioFS && h.VirtioFSDaemon == "" {
|
||||
if (sharedFS == config.VirtioFS || sharedFS == config.VirtioFSNydus) && h.VirtioFSDaemon == "" {
|
||||
return vc.HypervisorConfig{},
|
||||
errors.New("cannot enable virtio-fs without daemon path in configuration file")
|
||||
}
|
||||
|
||||
if sharedFS == config.VirtioFSNydus && h.VirtioFSDaemon == "" {
|
||||
return vc.HypervisorConfig{},
|
||||
errors.New("cannot enable virtio nydus without nydusd daemon path in configuration file")
|
||||
fmt.Errorf("cannot enable %s without daemon path in configuration file", sharedFS)
|
||||
}
|
||||
|
||||
if vSock, err := utils.SupportsVsocks(); !vSock {
|
||||
@@ -822,11 +817,18 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
return vc.HypervisorConfig{}, err
|
||||
}
|
||||
|
||||
sharedFS := config.VirtioFS
|
||||
sharedFS, err := h.sharedFS()
|
||||
if err != nil {
|
||||
return vc.HypervisorConfig{}, err
|
||||
}
|
||||
|
||||
if sharedFS != config.VirtioFS && sharedFS != config.VirtioFSNydus {
|
||||
return vc.HypervisorConfig{}, errors.New("clh only support virtio-fs or virtio-fs-nydus")
|
||||
}
|
||||
|
||||
if h.VirtioFSDaemon == "" {
|
||||
return vc.HypervisorConfig{},
|
||||
errors.New("virtio-fs daemon path is missing in configuration file")
|
||||
fmt.Errorf("cannot enable %s without daemon path in configuration file", sharedFS)
|
||||
}
|
||||
|
||||
return vc.HypervisorConfig{
|
||||
|
||||
@@ -633,6 +633,8 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
||||
PCIeRootPort: pcieRootPort,
|
||||
RxRateLimiterMaxRate: rxRateLimiterMaxRate,
|
||||
TxRateLimiterMaxRate: txRateLimiterMaxRate,
|
||||
SharedFS: "virtio-fs",
|
||||
VirtioFSDaemon: filepath.Join(dir, "virtiofsd"),
|
||||
}
|
||||
|
||||
files := []string{hypervisorPath, kernelPath, imagePath}
|
||||
@@ -1388,6 +1390,8 @@ func TestUpdateRuntimeConfigurationVMConfig(t *testing.T) {
|
||||
Image: "/",
|
||||
Firmware: "/",
|
||||
FirmwareVolume: "/",
|
||||
SharedFS: "virtio-fs",
|
||||
VirtioFSDaemon: "/usr/libexec/kata-qemu/virtiofsd",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user