diff --git a/src/runtime/virtcontainers/kata_agent.go b/src/runtime/virtcontainers/kata_agent.go index 3194ec6e84..e4eb2824e4 100644 --- a/src/runtime/virtcontainers/kata_agent.go +++ b/src/runtime/virtcontainers/kata_agent.go @@ -1543,14 +1543,11 @@ func (k *kataAgent) handleLocalStorage(mounts []specs.Mount, sandboxID string, r return localStorages, nil } -// handleDeviceBlockVolume handles volume that is block device file -// and DeviceBlock type. -func (k *kataAgent) handleDeviceBlockVolume(c *Container, m Mount, device api.Device) (*grpc.Storage, error) { +func handleBlockVolume(c *Container, device api.Device) (*grpc.Storage, error) { vol := &grpc.Storage{} blockDrive, ok := device.GetDeviceInfo().(*config.BlockDrive) if !ok || blockDrive == nil { - k.Logger().Error("malformed block drive") return nil, fmt.Errorf("malformed block drive") } switch { @@ -1575,6 +1572,22 @@ func (k *kataAgent) handleDeviceBlockVolume(c *Container, m Mount, device api.De default: return nil, fmt.Errorf("Unknown block device driver: %s", c.sandbox.config.HypervisorConfig.BlockDeviceDriver) } + return vol, nil +} + +// handleVirtualVolumeStorageObject handles KataVirtualVolume that is block device file. +func handleVirtualVolumeStorageObject(c *Container, blockDeviceId string, virtVolume *types.KataVirtualVolume) (*grpc.Storage, error) { + var vol *grpc.Storage = &grpc.Storage{} + return vol, nil +} + +// handleDeviceBlockVolume handles volume that is block device file +// and DeviceBlock type. +func (k *kataAgent) handleDeviceBlockVolume(c *Container, m Mount, device api.Device) (*grpc.Storage, error) { + vol, err := handleBlockVolume(c, device) + if err != nil { + return nil, err + } vol.MountPoint = m.Destination