mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
libs/types: use contains to make code more readable
use contains to when validate hypervisor block_device_driver Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
parent
45e5780e7c
commit
6ae87d9d66
@ -165,12 +165,14 @@ impl BlockDeviceInfo {
|
||||
if self.disable_block_device_use {
|
||||
return Ok(());
|
||||
}
|
||||
if self.block_device_driver != VIRTIO_BLK
|
||||
&& self.block_device_driver != VIRTIO_BLK_CCW
|
||||
&& self.block_device_driver != VIRTIO_BLK_MMIO
|
||||
&& self.block_device_driver != VIRTIO_SCSI
|
||||
&& self.block_device_driver != VIRTIO_PMEM
|
||||
{
|
||||
let l = [
|
||||
VIRTIO_BLK,
|
||||
VIRTIO_BLK_CCW,
|
||||
VIRTIO_BLK_MMIO,
|
||||
VIRTIO_SCSI,
|
||||
VIRTIO_PMEM,
|
||||
];
|
||||
if !l.contains(&self.block_device_driver.as_str()) {
|
||||
return Err(eother!(
|
||||
"{} is unsupported block device type.",
|
||||
self.block_device_driver
|
||||
|
Loading…
Reference in New Issue
Block a user