mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
runtime: redefine and add functions to handle VirtualVolume to storage
1) Extract function `handleBlockVolume` to create Storage only. 2) Add functions to handle KataVirtualVolume device and construct corresponding storages. Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
This commit is contained in:
parent
bd099fbda9
commit
0b4f7c2ee7
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user