runtime-rs: make function name more understandable

Change kparams to kernel_params for understandability.

Fixes: #5068
Signed-Off-By: Ji-Xinyou <jerryji0414@outlook.com>
This commit is contained in:
Ji-Xinyou
2022-09-21 11:39:15 +08:00
parent 426a436780
commit e23bfd615e
3 changed files with 13 additions and 15 deletions

View File

@@ -324,7 +324,7 @@ fn load_config(spec: &oci::Spec) -> Result<TomlConfig> {
let (mut toml_config, _) =
TomlConfig::load_from_file(&config_path).context("load toml config")?;
annotation.update_config_by_annotation(&mut toml_config)?;
update_agent_kparams(&mut toml_config)?;
update_agent_kernel_params(&mut toml_config)?;
// validate configuration and return the error
toml_config.validate()?;
@@ -351,16 +351,16 @@ fn load_config(spec: &oci::Spec) -> Result<TomlConfig> {
// this update the agent-specfic kernel parameters into hypervisor's bootinfo
// the agent inside the VM will read from file cmdline to get the params and function
fn update_agent_kparams(config: &mut TomlConfig) -> Result<()> {
fn update_agent_kernel_params(config: &mut TomlConfig) -> Result<()> {
let mut params = vec![];
if let Ok(kv) = config.get_agent_kparams() {
if let Ok(kv) = config.get_agent_kernel_params() {
for (k, v) in kv.into_iter() {
if let Ok(s) = Param::new(k.as_str(), v.as_str()).to_string() {
params.push(s);
}
}
if let Some(h) = config.hypervisor.get_mut(&config.runtime.hypervisor_name) {
h.boot_info.add_kparams(params);
h.boot_info.add_kernel_params(params);
}
}
Ok(())