kata-agent: Fix mismatching error of cgroup and mountinfo.

The content about systemd in "/proc/self/cgroup" is as:
1:name=systemd:/kubepods/pod1815643d-3789-4e4e-aaf4-00de024912e1/0e15a65bd5f7b30a0b818d90706212354d8b3f0998a1495473c3be9a24706ccf

and in "/prol/self/mountinfo" is as:
30 29 0:26 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:6 - cgroup cgroup rw,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd

The keys extracted from the two files are the same as "name=systemd". So no need to rename the key to "systemd".

Fixes: #3385

Signed-off-by: sailorvii <challengingway@hotmail.com>
This commit is contained in:
sailorvii 2022-02-28 10:03:09 +08:00
parent c6cc038364
commit 8edca8bbd1

View File

@ -905,13 +905,7 @@ pub fn get_paths() -> Result<HashMap<String, String>> {
let keys: Vec<&str> = fl[1].split(',').collect();
for key in &keys {
// this is a workaround, cgroup file are using `name=systemd`,
// but if file system the name is `systemd`
if *key == "name=systemd" {
m.insert("systemd".to_string(), fl[2].to_string());
} else {
m.insert(key.to_string(), fl[2].to_string());
}
m.insert(key.to_string(), fl[2].to_string());
}
}
Ok(m)