libs/types: fixed spelling and grammer error

fixed spelling and grammer error in some files

Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
Zhongtao Hu 2022-01-31 10:14:28 +08:00 committed by Fupan Li
parent 2599a06a56
commit 45e5780e7c
6 changed files with 22 additions and 22 deletions

View File

@ -325,12 +325,12 @@ impl Annotation {
} }
/// Get an immutable reference to the annotation hashmap. /// Get an immutable reference to the annotation hashmap.
pub fn get_annotation(&self) -> &HashMap<String, String> { pub fn get_annotations(&self) -> &HashMap<String, String> {
&self.annotations &self.annotations
} }
/// Get a mutable reference to the annotation hashmap. /// Get a mutable reference to the annotation hashmap.
pub fn get_annotation_mut(&mut self) -> &mut HashMap<String, String> { pub fn get_annotations_mut(&mut self) -> &mut HashMap<String, String> {
&mut self.annotations &mut self.annotations
} }
@ -609,7 +609,7 @@ impl Annotation {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::InvalidData, io::ErrorKind::InvalidData,
format!( format!(
"Memory specified in annotation {} is less than minmum required {}", "Memory specified in annotation {} is less than minimum required {}",
mem, mem,
get_hypervisor_plugin(hypervisor_name) get_hypervisor_plugin(hypervisor_name)
.unwrap() .unwrap()
@ -627,7 +627,7 @@ impl Annotation {
None => { None => {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::InvalidData, io::ErrorKind::InvalidData,
format!("{}in annotation is less than zero", key), format!("{} in annotation is less than zero", key),
)); ));
} }
}, },
@ -715,7 +715,7 @@ impl Annotation {
_ => { _ => {
return Err(io::Error::new( return Err(io::Error::new(
io::ErrorKind::InvalidInput, io::ErrorKind::InvalidInput,
format!("Invalid Annotation Type {}", key), format!("Invalid annotation type {}", key),
)); ));
} }
} }

View File

@ -51,7 +51,7 @@ pub struct Agent {
#[serde(default)] #[serde(default)]
pub kernel_modules: Vec<String>, pub kernel_modules: Vec<String>,
/// contianer pipe size /// container pipe size
pub container_pipe_size: u32, pub container_pipe_size: u32,
} }

View File

@ -35,8 +35,8 @@ pub const DEFAULT_GUEST_HOOK_PATH: &str = "/opt";
pub const DEFAULT_GUEST_VCPUS: u32 = 1; pub const DEFAULT_GUEST_VCPUS: u32 = 1;
// Default configuration for Dragonball // Default configuration for Dragonball
pub const DEFAULT_DB_GUEST_KENREL_IMAGE: &str = "vmlinuz"; pub const DEFAULT_DB_GUEST_KERNEL_IMAGE: &str = "vmlinuz";
pub const DEFAULT_DB_GUEST_KENREL_PARAMS: &str = ""; pub const DEFAULT_DB_GUEST_KERNEL_PARAMS: &str = "";
pub const DEFAULT_DB_ENTROPY_SOURCE: &str = "/dev/urandom"; pub const DEFAULT_DB_ENTROPY_SOURCE: &str = "/dev/urandom";
pub const DEFAULT_DB_MEMORY_SIZE: u32 = 128; pub const DEFAULT_DB_MEMORY_SIZE: u32 = 128;
pub const DEFAULT_DB_MEMORY_SLOTS: u32 = 128; pub const DEFAULT_DB_MEMORY_SLOTS: u32 = 128;
@ -47,8 +47,8 @@ pub const DEFAULT_QEMU_BINARY_PATH: &str = "qemu";
pub const DEFAULT_QEMU_CONTROL_PATH: &str = ""; pub const DEFAULT_QEMU_CONTROL_PATH: &str = "";
pub const DEFAULT_QEMU_MACHINE_TYPE: &str = "q35"; pub const DEFAULT_QEMU_MACHINE_TYPE: &str = "q35";
pub const DEFAULT_QEMU_ENTROPY_SOURCE: &str = "/dev/urandom"; pub const DEFAULT_QEMU_ENTROPY_SOURCE: &str = "/dev/urandom";
pub const DEFAULT_QEMU_GUEST_KENREL_IMAGE: &str = "vmlinuz"; pub const DEFAULT_QEMU_GUEST_KERNEL_IMAGE: &str = "vmlinuz";
pub const DEFAULT_QEMU_GUEST_KENREL_PARAMS: &str = ""; pub const DEFAULT_QEMU_GUEST_KERNEL_PARAMS: &str = "";
pub const DEFAULT_QEMU_FIRMWARE_PATH: &str = ""; pub const DEFAULT_QEMU_FIRMWARE_PATH: &str = "";
pub const DEFAULT_QEMU_MEMORY_SIZE: u32 = 128; pub const DEFAULT_QEMU_MEMORY_SIZE: u32 = 128;
pub const DEFAULT_QEMU_MEMORY_SLOTS: u32 = 128; pub const DEFAULT_QEMU_MEMORY_SLOTS: u32 = 128;

View File

@ -54,10 +54,10 @@ impl ConfigPlugin for DragonballConfig {
resolve_path!(db.jailer_path, "Dragonball jailer path {} is invalid: {}")?; resolve_path!(db.jailer_path, "Dragonball jailer path {} is invalid: {}")?;
if db.boot_info.kernel.is_empty() { if db.boot_info.kernel.is_empty() {
db.boot_info.kernel = default::DEFAULT_DB_GUEST_KENREL_IMAGE.to_string(); db.boot_info.kernel = default::DEFAULT_DB_GUEST_KERNEL_IMAGE.to_string();
} }
if db.boot_info.kernel_params.is_empty() { if db.boot_info.kernel_params.is_empty() {
db.boot_info.kernel_params = default::DEFAULT_DB_GUEST_KENREL_PARAMS.to_string(); db.boot_info.kernel_params = default::DEFAULT_DB_GUEST_KERNEL_PARAMS.to_string();
} }
if db.cpu_info.default_maxvcpus > default::MAX_DB_VCPUS { if db.cpu_info.default_maxvcpus > default::MAX_DB_VCPUS {

View File

@ -336,7 +336,7 @@ pub struct DebugInfo {
/// exist. The dumped file(also called vmcore) can be processed with crash or gdb. /// exist. The dumped file(also called vmcore) can be processed with crash or gdb.
/// ///
/// # WARNING: /// # WARNING:
/// Dump guests memory can take very long depending on the amount of guest memory and use /// Dump guest's memory can take very long depending on the amount of guest memory and use
/// much disk space. /// much disk space.
#[serde(default)] #[serde(default)]
pub guest_memory_dump_path: String, pub guest_memory_dump_path: String,
@ -415,7 +415,7 @@ impl DeviceInfo {
pub fn validate(&self) -> Result<()> { pub fn validate(&self) -> Result<()> {
if self.default_bridges > 5 { if self.default_bridges > 5 {
return Err(eother!( return Err(eother!(
"The configured PCI bridges {} is too big", "The configured PCI bridges {} are too many",
self.default_bridges self.default_bridges
)); ));
} }
@ -479,7 +479,7 @@ impl MachineInfo {
/// Validate the configuration information. /// Validate the configuration information.
pub fn validate(&self) -> Result<()> { pub fn validate(&self) -> Result<()> {
for pflash in self.pflashes.iter() { for pflash in self.pflashes.iter() {
validate_path!(*pflash, "Flash image file {} is invalide: {}")?; validate_path!(*pflash, "Flash image file {} is invalid: {}")?;
} }
validate_path!(self.entropy_source, "Entropy source {} is invalid: {}")?; validate_path!(self.entropy_source, "Entropy source {} is invalid: {}")?;
Ok(()) Ok(())
@ -578,10 +578,10 @@ impl MemoryInfo {
"Memory backend file {} is invalid: {}" "Memory backend file {} is invalid: {}"
)?; )?;
if self.default_memory == 0 { if self.default_memory == 0 {
return Err(eother!("Configured memory size for guest vm is zero")); return Err(eother!("Configured memory size for guest VM is zero"));
} }
if self.memory_slots == 0 { if self.memory_slots == 0 {
return Err(eother!("Configured memory slots for guest vm is zero")); return Err(eother!("Configured memory slots for guest VM are zero"));
} }
Ok(()) Ok(())

View File

@ -61,11 +61,11 @@ impl ConfigPlugin for QemuConfig {
resolve_path!(qemu.ctlpath, "Qemu ctlpath `{}` is invalid: {}")?; resolve_path!(qemu.ctlpath, "Qemu ctlpath `{}` is invalid: {}")?;
if qemu.boot_info.kernel.is_empty() { if qemu.boot_info.kernel.is_empty() {
qemu.boot_info.kernel = default::DEFAULT_QEMU_GUEST_KENREL_IMAGE.to_string(); qemu.boot_info.kernel = default::DEFAULT_QEMU_GUEST_KERNEL_IMAGE.to_string();
} }
if qemu.boot_info.kernel_params.is_empty() { if qemu.boot_info.kernel_params.is_empty() {
qemu.boot_info.kernel_params = qemu.boot_info.kernel_params =
default::DEFAULT_QEMU_GUEST_KENREL_PARAMS.to_string(); default::DEFAULT_QEMU_GUEST_KERNEL_PARAMS.to_string();
} }
if qemu.boot_info.firmware.is_empty() { if qemu.boot_info.firmware.is_empty() {
qemu.boot_info.firmware = default::DEFAULT_QEMU_FIRMWARE_PATH.to_string(); qemu.boot_info.firmware = default::DEFAULT_QEMU_FIRMWARE_PATH.to_string();
@ -99,10 +99,10 @@ impl ConfigPlugin for QemuConfig {
/// Validate the configuration information. /// Validate the configuration information.
fn validate(&self, conf: &TomlConfig) -> Result<()> { fn validate(&self, conf: &TomlConfig) -> Result<()> {
if let Some(qemu) = conf.hypervisor.get(HYPERVISOR_NAME_QEMU) { if let Some(qemu) = conf.hypervisor.get(HYPERVISOR_NAME_QEMU) {
validate_path!(qemu.path, "Qemu binary path `{}` is invalid: {}")?; validate_path!(qemu.path, "QEMU binary path `{}` is invalid: {}")?;
validate_path!(qemu.ctlpath, "Qemu control path `{}` is invalid: {}")?; validate_path!(qemu.ctlpath, "QEMU control path `{}` is invalid: {}")?;
if !qemu.jailer_path.is_empty() { if !qemu.jailer_path.is_empty() {
return Err(eother!("Path for Qemu jailer should be empty")); return Err(eother!("Path for QEMU jailer should be empty"));
} }
if !qemu.valid_jailer_paths.is_empty() { if !qemu.valid_jailer_paths.is_empty() {
return Err(eother!("Valid Qemu jailer path list should be empty")); return Err(eother!("Valid Qemu jailer path list should be empty"));