Files
kata-containers/virtcontainers/device/api/mockDeviceReceiver.go
Li Yuxuan e9a46580b1 vc: Use BlockIndexMap instead of BlockIndex
This allows to reuse detached block index and ensures that the
index will not reach the limit of device(such as `maxSCSIDevices`)
after restarting containers many times in one pod.

Fixes: #2007
Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2020-03-03 10:30:18 +08:00

44 lines
1.1 KiB
Go

// Copyright (c) 2018 Huawei Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package api
import (
"github.com/kata-containers/runtime/virtcontainers/device/config"
)
// MockDeviceReceiver is a fake DeviceReceiver API implementation only used for test
type MockDeviceReceiver struct{}
// HotplugAddDevice adds a new device
func (mockDC *MockDeviceReceiver) HotplugAddDevice(Device, config.DeviceType) error {
return nil
}
// HotplugRemoveDevice removes a device
func (mockDC *MockDeviceReceiver) HotplugRemoveDevice(Device, config.DeviceType) error {
return nil
}
// GetAndSetSandboxBlockIndex is used for get and set virtio-blk indexes
func (mockDC *MockDeviceReceiver) GetAndSetSandboxBlockIndex() (int, error) {
return 0, nil
}
// DecrementSandboxBlockIndex decreases virtio-blk index by one
func (mockDC *MockDeviceReceiver) UnsetSandboxBlockIndex(int) error {
return nil
}
// AppendDevice adds new vhost user device
func (mockDC *MockDeviceReceiver) AppendDevice(Device) error {
return nil
}
// GetHypervisorType is used for getting Hypervisor name currently used.
func (mockDC *MockDeviceReceiver) GetHypervisorType() string {
return ""
}