libs: Change kv of get_agent_kernel_params to BTreeMap

HashMap cannot guarantee the order.  The command line is always changed.
This commit change kv of get_agent_kernel_params to BTreeMap to make
sure the command line is not changed.

Fixes: #10977

Signed-off-by: Hui Zhu <teawater@antgroup.com>
This commit is contained in:
Hui Zhu 2025-02-25 09:57:43 +08:00
parent 4bb0eb4590
commit 1b4961c9db

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
use std::collections::HashMap; use std::collections::{BTreeMap, HashMap};
use std::fs; use std::fs;
use std::io::{self, Result}; use std::io::{self, Result};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -192,8 +192,8 @@ impl TomlConfig {
} }
/// Get agent-specfic kernel parameters for further Hypervisor config revision /// Get agent-specfic kernel parameters for further Hypervisor config revision
pub fn get_agent_kernel_params(&self) -> Result<HashMap<String, String>> { pub fn get_agent_kernel_params(&self) -> Result<BTreeMap<String, String>> {
let mut kv = HashMap::new(); let mut kv = BTreeMap::new();
if let Some(cfg) = self.agent.get(&self.runtime.agent_name) { if let Some(cfg) = self.agent.get(&self.runtime.agent_name) {
if cfg.debug { if cfg.debug {
kv.insert(LOG_LEVEL_OPTION.to_string(), LOG_LEVEL_DEBUG.to_string()); kv.insert(LOG_LEVEL_OPTION.to_string(), LOG_LEVEL_DEBUG.to_string());