mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-18 07:18:27 +00:00
kata-types: Clean up noise caused by unformatted code
For a long time, there has been unformatted code in the kata-types codebase, for example: ``` if qemu.memory_info.enable_guest_swap { - return Err(eother!( - "Qemu hypervisor doesn't support enable_guest_swap" - )); + return Err(eother!("Qemu hypervisor doesn't support enable_guest_swap")); } ... - }, device::DRIVER_NVDIMM_TYPE, eother, resolve_path + }, + device::DRIVER_NVDIMM_TYPE, + eother, resolve_path, -use std::collections::HashMap; -use anyhow::{Result, anyhow}; +use anyhow::{anyhow, Result}; use std::collections::hash_map::Entry; +use std::collections::HashMap; -/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci +/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci ``` This has brought unnecessary difficulties in version maintenance and commit difficulties. This commit will address this issue. Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -119,7 +119,9 @@ impl ConfigPlugin for QemuConfig {
|
||||
}
|
||||
if qemu.boot_info.image.is_empty() && qemu.boot_info.initrd.is_empty() {
|
||||
// IBM SE (CCW + confidential guest) does not require neither image nor initrd.
|
||||
if !(qemu.boot_info.vm_rootfs_driver.ends_with("ccw") && qemu.security_info.confidential_guest) {
|
||||
if !(qemu.boot_info.vm_rootfs_driver.ends_with("ccw")
|
||||
&& qemu.security_info.confidential_guest)
|
||||
{
|
||||
return Err(eother!(
|
||||
"Both guest boot image and initrd for qemu are empty"
|
||||
));
|
||||
@@ -151,9 +153,7 @@ impl ConfigPlugin for QemuConfig {
|
||||
}
|
||||
|
||||
if qemu.memory_info.enable_guest_swap {
|
||||
return Err(eother!(
|
||||
"Qemu hypervisor doesn't support enable_guest_swap"
|
||||
));
|
||||
return Err(eother!("Qemu hypervisor doesn't support enable_guest_swap"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,9 @@ use crate::{
|
||||
config::{
|
||||
default::{self, MAX_REMOTE_VCPUS, MIN_REMOTE_MEMORY_SIZE_MB},
|
||||
ConfigPlugin,
|
||||
}, device::DRIVER_NVDIMM_TYPE, eother, resolve_path
|
||||
},
|
||||
device::DRIVER_NVDIMM_TYPE,
|
||||
eother, resolve_path,
|
||||
};
|
||||
|
||||
use super::register_hypervisor_plugin;
|
||||
|
@@ -15,7 +15,7 @@ pub const DRIVER_BLK_MMIO_TYPE: &str = "mmioblk";
|
||||
pub const DRIVER_SCSI_TYPE: &str = "scsi";
|
||||
/// DRIVER_NVDIMM_TYPE is the device driver for nvdimm
|
||||
pub const DRIVER_NVDIMM_TYPE: &str = "nvdimm";
|
||||
/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci
|
||||
/// DRIVER_VFIO_PCI_GK_TYPE is the device driver for vfio-pci
|
||||
/// while the device will be bound to a guest kernel driver
|
||||
pub const DRIVER_VFIO_PCI_GK_TYPE: &str = "vfio-pci-gk";
|
||||
/// DRIVER_VFIO_PCI_TYPE is the device driver for vfio-pci
|
||||
|
@@ -3,16 +3,16 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use std::collections::HashMap;
|
||||
use anyhow::{Result, anyhow};
|
||||
use anyhow::{anyhow, Result};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Generic manager to manage registered handlers.
|
||||
pub struct HandlerManager<H> {
|
||||
handlers: HashMap<String, H>,
|
||||
}
|
||||
|
||||
impl<H> Default for HandlerManager<H>
|
||||
impl<H> Default for HandlerManager<H>
|
||||
where
|
||||
H: Clone,
|
||||
{
|
||||
@@ -21,7 +21,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<H> HandlerManager<H>
|
||||
impl<H> HandlerManager<H>
|
||||
where
|
||||
H: Clone,
|
||||
{
|
||||
|
Reference in New Issue
Block a user