device: use const strings for block-driver option instead of hard coding

Currently, the block driver option is specifed by hard coding, maybe it
is better to use const string variables instead of hard coded strings.
Another modification is to remove duplicate consts for virtio driver in
manager.go.

Fixes: #3321

Signed-off-by: Jason Zhang <zhanghj.lc@inspur.com>
This commit is contained in:
zhanghj
2022-03-14 09:17:04 +08:00
committed by Jason Zhang
parent 358081c4ae
commit efa19c41eb
13 changed files with 53 additions and 60 deletions

View File

@@ -86,7 +86,7 @@ func TestContainerRemoveDrive(t *testing.T) {
sandbox := &Sandbox{
ctx: context.Background(),
id: "sandbox",
devManager: manager.NewDeviceManager(manager.VirtioSCSI, false, "", nil),
devManager: manager.NewDeviceManager(config.VirtioSCSI, false, "", nil),
config: &SandboxConfig{},
}
@@ -320,7 +320,7 @@ func TestContainerAddDriveDir(t *testing.T) {
sandbox := &Sandbox{
ctx: context.Background(),
id: testSandboxID,
devManager: manager.NewDeviceManager(manager.VirtioSCSI, false, "", nil),
devManager: manager.NewDeviceManager(config.VirtioSCSI, false, "", nil),
hypervisor: &mockHypervisor{},
agent: &mockAgent{},
config: &SandboxConfig{