mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +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 {
|
if self.disable_block_device_use {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if self.block_device_driver != VIRTIO_BLK
|
let l = [
|
||||||
&& self.block_device_driver != VIRTIO_BLK_CCW
|
VIRTIO_BLK,
|
||||||
&& self.block_device_driver != VIRTIO_BLK_MMIO
|
VIRTIO_BLK_CCW,
|
||||||
&& self.block_device_driver != VIRTIO_SCSI
|
VIRTIO_BLK_MMIO,
|
||||||
&& self.block_device_driver != VIRTIO_PMEM
|
VIRTIO_SCSI,
|
||||||
{
|
VIRTIO_PMEM,
|
||||||
|
];
|
||||||
|
if !l.contains(&self.block_device_driver.as_str()) {
|
||||||
return Err(eother!(
|
return Err(eother!(
|
||||||
"{} is unsupported block device type.",
|
"{} is unsupported block device type.",
|
||||||
self.block_device_driver
|
self.block_device_driver
|
||||||
|
Loading…
Reference in New Issue
Block a user